如果我然后尝试删除重复项,我会收到 TypeError ......为什么?
临时列表=列表(设置(临时列表))
错误:TypeError:文件第 29 行:“str”对象不可调用#
这是真正的代码:
# Lists all UI elements
allUI=pm.lsUI()[24:28]
#Main Window Name
win='searchElementsUI'
#Lists for UI Hierachy
allSplitUI=[]
maxLenUI=[]
parentDict={}
#Splits UI Elements
for ui in allUI:
allSplitUI.append(ui.split('|'))
#Max length of UISplit
for ui in allSplitUI:
maxLenUI.append(len(ui))
maxLenUI=max(maxLenUI)
#Adds main Parents to list
tempList=[]
for i in range(maxLenUI):
tempList=[]
for ui in allSplitUI:
try:
tempList.append(ui[i])
except:pass
tempList=list(set(tempList))
parentDict['list%s'%i]=tempList
这是来自 Maya 的完整回溯:
# Lists all UI elements
allUI=pm.lsUI()
#Main Window Name
win='searchElementsUI'
#Lists for UI Hierachy
allSplitUI=[]
maxLenUI=[]
parentDict={}
#Splits UI Elements
for ui in allUI:
allSplitUI.append(ui.split('|'))
#Max length of UISplit
for ui in allSplitUI:
maxLenUI.append(len(ui))
maxLenUI=max(maxLenUI)
#Adds main Parents to list
tempList=[]
for i in range(maxLenUI):
tempList=[]
for ui in allSplitUI:
try:
tempList.append(ui[i])
except:pass
tempList=list(set(tempList))
parentDict['list%s'%i]=tempList
# Error: 'str' object is not callable
# Traceback (most recent call last):
# File "<maya console>", line 29, in <module>
# TypeError: 'str' object is not callable #