Reference an Element in a List of Tuples

后端 未结 7 429
无人共我
无人共我 2020-12-08 10:37

Sorry in advance, but I\'m new to Python. I have a list of tuples, and I was wondering how I can reference, say, the first element of each tuple w

7条回答
  •  甜味超标
    2020-12-08 11:07

    Rather than:

    first_element = myList[i[0]]
    

    You probably want:

    first_element = myList[i][0]
    

提交回复
热议问题