TypeError: list indices must be integers or slices, not str
今天写学生信息管理系统的时候出现的一个错误

Python中常见的错误
Python中常见的错误
Python中常见的错误

本来是想对字典中的信息进行遍历,却不小心写成了列表,后来列表改为字典就行了
Python中常见的错误

TypeError: ‘type’ object is not subscriptable
这种错误说明你把不具有下标操作的对象加上了索引
Python中常见的错误
和明显的可以看到我在地28行for中明明定义的是i,却在29行的if中用的是dict,将其改正就正确了

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-03
  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
  • 2021-06-08
猜你喜欢
  • 2022-02-05
  • 2021-07-22
  • 2021-09-17
  • 2021-11-19
  • 2022-12-23
  • 2021-08-15
相关资源
相似解决方案