TypeError: list indices must be integers, not tuple, whats wrong [duplicate]
问题 This question already has answers here : Python 'list indices must be integers, not tuple" error (6 answers) Closed 3 years ago . New in Python, help. Why i get this error: "TypeError: list indices must be integers, not tuple," imheight = [] for i in range(0,len(tables)): for j in range(0,len(tables)): hij = computeHeight(imp[i],imp[j],'Meter') imheight[i,j] = hij imheight[j,i] = hij 回答1: This syntax is wrong: imheight[i,j] = hij imheight[j,i] = hij Perhaps you meant this? imheight[i][j] =