IndexError: list index out of range and python

后端 未结 8 2434
醉酒成梦
醉酒成梦 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条回答
  •  我寻月下人不归
    2020-11-22 05:03

    The way Python indexing works is that it starts at 0, so the first number of your list would be [0]. You would have to print[52], as the starting index is 0 and therefore line 53 is [52].

    Subtract 1 from the value and you should be fine. :)

提交回复
热议问题