-1
我有一個程序,在稱爲小狗的二維數組中尋找一個特定的ID,當我這樣做,我的程序崩潰與列表索引超出範圍錯誤。這裏是代碼的有關章節:列表索引超出範圍錯誤在Python - 二維數組
for i in range(1,len(pups)): # start from 1 as the first row contains the labels
if pups[i][0]==ID:
report=pups[i]
pups.pop(i)
succesful=True
我在蟒蛇新的,所以如果我犯了一個愚蠢的錯誤,我會很高興,如果你能告訴我 - 在此先感謝。
不要變異爲你通過它迭代列表('pups'在這種情況下) – CoryKramer
python註釋字符是'#' – Will
哦,我看到了 - 謝謝你的回答 –