IndexError:列表索引超出范围和Python [英] IndexError: list index out of range and python

查看:71
本文介绍了IndexError:列表索引超出范围和Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我告诉我的程序打印输出的第53行.这个错误告诉我没有太多行,因此无法将其打印出来吗?

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?

推荐答案

如果列表包含53个项目,则最后一个为thelist[52],因为索引从0开始.

If you have a list with 53 items, the last one is thelist[52] because indexing start at 0.

这篇关于IndexError:列表索引超出范围和Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆