IndexError: list index out of range and python

后端 未结 8 2373
醉酒成梦
醉酒成梦 2020-11-22 04:58

I\'m telling my program to print out line 53 of an output. Is this error telling me that there aren\'t that many lines and therefore can not print it out?

8条回答
  •  Happy的楠姐
    2020-11-22 05:08

    If you read a list from text file, you may get the last empty line as a list element. You can get rid of it like this:

    list.pop()
    for i in list:
       i[12]=....
    

提交回复
热议问题