python 3.x 版本解決TypeError:‘dict-keys’ object does not support indexing的問題

 python3改變了dict.keys,返回的是dict_keys對象,支持iterable 但不支持indexable,咱們python 能夠將其明確的轉化成list。spa 在python2中對象 firstStr = myTree.keys()[0]it 在python3中im firstStr = list(myTree.keys())[0]dict
相關文章
相關標籤/搜索