TypeError: 'dict_keys' object does not support indexing

TypeError: 'dict_keys' object does not support indexing

在python2中,dict.keys()得到一个列表,而在python3中,返回的是class 'dict_keys'没有索引顺序,不能用index。想要得到列表就用list(dict.keys())转换一下。

你可能感兴趣的:(TypeError: 'dict_keys' object does not support indexing)