帮助!就在我让一件事起作用时,另一件事却不起作用!同样,我确信经验丰富的眼睛很简单,但我很挣扎!这是我生成列表和所述列表数据的代码。
#Frame Creation
allframes = []
for n in range (0, (workingframes*archnodes*3)):
allframes.append(n)
frames = allframes
print frames
#Frame Population
for f in range (0, workingframes):
if f<=(workingframes/2):
for x in range (0, (archnodes)):
frames[((archnodes*3)+f)].insert(((archnodes*3)+f), (archstartred[x]))
frames[((archnodes*3)+f+workingframes)].insert(((archnodes*3)+f+workingframes),(archstartgrn[x]))
frames[((archnodes*3)+f+workingframes*2)].insert(((archnodes*3)+f+workingframes*2),(archstartblu[x]))
for y in range (0, nodesperframe):
archstartred.pop()
archstartgrn.pop()
archstartblu.pop()
archstartred.insert(0, backred)
archstartgrn.insert(0, backgrn)
archstartblu.insert(0, backblu)
else:
for y in range (0, nodesperframe):
archstartred.pop(0)
archstartgrn.pop(0)
archstartblu.pop(0)
archstartred.append(backred)
archstartgrn.append(backgrn)
archstartblu.append(backblu)
for x in range (0, (archnodes)):
frames[(archnodes*3)+f].insert((archnodes*3), (archstartred[x]))
frames[(archnodes*3)+f+workingframes].insert(((archnodes*3)+1),(archstartgrn[x]))
frames[(archnodes*3)+f+workingframes*2].insert(((archnodes*3)+2),(archstartblu[x]))
我不断收到这个可爱的错误:
AttributeError: 'int' object has no attribute 'insert'
我计划在填充列表后将列表转换为数组,以便我可以按照需要的方式对其进行操作。我确信有一种更简单的方法可以做到这一点,但我不知道,而且我是 Python 新手!