TypeError: 'dict_keys' object does not support indexing

在python2.x中,dict.keys()返回一个列表,在python3.x中,dict.keys()返回一个dict_keys对象,比起列表,这个对象的行为更像是set,因此不支持索引的。python

解决方案:list(dict.keys())[index]python3.x

相关文章
相关标签/搜索