索引错误:列表索引超出范围(Python) [英] Index Error: list index out of range (Python)

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

问题描述

我是初学程序员,我不知道这意味着什么...

I am a beginner programmer and im not sure what this means...

索引错误:列表索引超出范围

Index Error: list index out of range

推荐答案

通常它意味着您提供的列表元素不存在的索引。

Generally it means that you are providing an index for which a list element does not exist.

例如,如果您的列表是 [1,3,5,7] ,并且您要求索引为10的元素,那么您将完全超出界限并收到错误,因为只存在元素0到3。

E.g, if your list was [1, 3, 5, 7], and you asked for the element at index 10, you would be well out of bounds and receive an error, as only elements 0 through 3 exist.

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

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