'int' object is not subscriptable
时间: 2023-09-30 16:12:48 浏览: 58
《Python数据分析基础》笔记:“TypeError, ‘int’ object is not iterable”
This error occurs when you try to access an index or slice of an integer object in Python.
For example, if you have a variable `x` that is an integer and you try to access a specific index or slice like `x[0]` or `x[1:3]`, you will get this error because integer objects do not support indexing or slicing.
To fix this error, you need to make sure that you are only using indexing and slicing operations on objects that support those operations, such as lists, tuples, and strings.
阅读全文