Error statement:
id_name_dic.keys()[2]
mistake:
'dict_keys' object does not support indexing
This is how python2 is written . In python2.x, dict.keys() returns a list. In python3.x, dict.keys() returns a dict_keys object, which behaves more like a set than a list. So indexing is not supported.
解决方案:list(dict.keys())[index]