网页学习体会

  • 首页
  • 个人博客
您的位置: 首页  >  技术问答  >  错误类型 list indices must be integers or slices,not str

错误类型 list indices must be integers or slices,not str

分类: 技术问答 • 2022-03-10 08:32:42
问题描述:

img

img

答

你第9行for i in list表示i是list里的对象,而你第10行list[i]把i当成了索引。解决方法是第9行改成for i in range(len(list))或者第10行改成list.count(i) >= 2

相关推荐

  • Python: list indices must be integers or slices, not float问题
  • requests+unittest接口自动化之报错:TypeError: list indices must be integers or slices, not str
  • TypeError: list indices must be integers or slices, not tuple
  • Python BeautifulSoup [解决方法] TypeError: list indices must be integers or slices, not str
  • 错误类型 list indices must be integers or slices,not str
  • 出错啦,怎么解决呀 :TypeError: list indices must be integers or slices, not tuple
  • Python报错list indices must be integers, not str
  • list indices must be integers or slices, not str
  • Python报错list indices must be integers, not str
  • 请问python调取数组某一位时出现list indices must be integers or slices, not str如何处理?
  • Golang Cron Job vs time.Ticker用例
  • fgets函数与字符串长度问题求解
    网站免责声明 网站地图 最新文章 用户隐私 版权申明
本站所有数据收集于网络,如果侵犯到您的权益,请联系网站进行下架处理。   

Copyright © 2018-2021   Powered By 网页学习体会    备案号:   粤ICP备20002247号