我在网上搜索了近一个小时,但找不到任何东西。但是我离题了,第6行一直回到TypeError: 'int' object is unsubscriptable
。请帮我确定是什么原因造成的。'int'对象不可订阅
def __reassigner__(allL, currentRow, currentSpace):
changingRow=currentRow+1
newl=[-1]*24
while changingRow<8:
distance = changingRow-currentRow
newl[8:15]=allL[changingRow[0:7]] #Line 6, this one
if newl[currentSpace]==-1:
newl[currentSpace]= currentRow
if newl[currentSpace-distance]==-1:
newl[currentSpace-distance]= currentRow
if newl[currentSpace+distance]==-1:
newl[currentSpace+distance]= currentRow
allL[changingRow[0:7]]=newl[8:15]
changingRow+=1
return(allL)
与您的问题无关,但名称\ _ \ _包围\ _ \ _通过双下划线应该用于Python的内置功能和[样式指南](http://www.python.org/dev/peps/pep-0008 /)禁止创建自己的。 – 2011-06-11 23:16:05