Python错误TypeError list indices must be integers or slices, not str - Xiao-Le Deng (邓小乐)

Xiao-Le Deng (邓小乐)

HomeResearchPublicationsToolsDaoLifeTagsSearchAbout

Python错误TypeError list indices must be integers or slices, not str

2023-12-18
#Python

错误为:

TypeError: list indices must be integers or slices, not str

解决方案 1:

for i in range(len(listname)):
    ...
    ...

参考

  1. python - TypeError: list indices must be integers or slices, not str - Stack Overflow
——
2012 – 2025 © Xiao-Le Deng · Powered by Simple Style