我的代碼「列表索引必須是整數,沒有列出」,而accesing名單
v_recorrido= [[4, 45], [4, 15], [4, 45]]
t=0
for i in v_recorrido:
seg = 60*v_recorrido[i][0] + v_recorrido[i][1]
此行的列表元素都扔我這個錯誤:
TypeError: list indices must be integers, not list
爲什麼?我是Python的新手(主要來自C++),但我已經檢查了文檔的語法,它似乎是正確的。
你有擡頭的'for'語句[文件](https://docs.python.org/3/reference/compound_stmts.html#the-for-statement)?或者檢出[教程](https://docs.python.org/3/tutorial/controlflow.html#for-statements)?這種行爲被極其徹底地記錄下來。 – TigerhawkT3
將這個問題的確切標題放入Google搜索中,而不是SO的「提問問題」框也會很有用。 – TigerhawkT3