我在網上搜索了近一個小時,但找不到任何東西。但是我離題了,第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