【发布时间】:2016-03-09 03:35:06
【问题描述】:
题目中的问题
示例代码:
>>> j.type()
u'joint'
>>> type(j)
<class 'pymel.core.nodetypes.Joint'>
【问题讨论】:
题目中的问题
示例代码:
>>> j.type()
u'joint'
>>> type(j)
<class 'pymel.core.nodetypes.Joint'>
【问题讨论】:
看看这个简单的例子。您正在尝试比较两个不同的东西 - Joint 类方法 type 和 python 内置函数 type - 它们都有相同的名称:
class Joint():
def type(self):
return u'joint'
>>> j = Joint()
>>> j.type()
'joint'
>>> type(j)
<class '__main__.Joint'>
【讨论】:
return u'joint'。但是当我意识到你在 python3 上(通过内置的type 返回值)时,我在 python 3 中运行了我的代码并发布了结果。我认为您使用的是 windows,因为在 python3 中的 linux 上,打印的字符串值前面没有 u(在我的示例中调用 j.type() 的结果),python 3 中的所有字符串默认情况下都是 unicode...