热线电话:13121318867

登录
2020-05-18 阅读量: 697
python报错:IndexError: list index out of range

问:

python报错:IndexError: list index out of range,是什么原因?

答:

这是因为L的索引超出范围,L是[1, 2, 3, 4, 5, 6, 7, 8, 9]共9个数,L[i]设置的遍历范围为L[1]-L[9],L[9]超出范围不存在便会报错。

37.6342
1
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子