已解决AttributeError: ‘dict_values‘ object has no attribute ‘index‘

已解决AttributeError: ‘dict_values‘ object has no attribute ‘index‘_解决方法


文章目录

  • 报错问题
  • 解决方法
  • 声明


报错问题

之前在工作中遇到过这个坑,记录一下问题以及解决方法,不一定针对所有情况都能用,但是可以供大家参考。
问题描述如下:

AttributeError: ‘dict_values‘ object has no attribute ‘index‘

属性错误:“age_dict"对象没有属性"index”

已解决AttributeError: ‘dict_values‘ object has no attribute ‘index‘_开发语言_02

解决方法

已解决AttributeError: ‘dict_values‘ object has no attribute ‘index‘_python_03



print(age_dict.keys())

改为

Print(list(age_dict.keys()))

声明

解决方法参考网络,如有侵权联系我删除