我正在使用一些給我的python代碼,並且它在我的系統上失敗。特別是在from collections import OrderedDict
的資本O和資本D. 的聲明但如果我更改聲明爲import ordereddict
它不會失敗。 如果我嘗試import OrderedDict
,它會失敗並顯示未找到錯誤。from collections import OrderedDict and python version
我的版本的python是每個SuSE SLES SDK 11.4 2.6.9。 我試圖執行的python我相信是爲Python的早期版本2.6.x編寫的。
是這個問題我遇到了python版本的直接結果嗎? 有沒有人有任何建議如何正確解決這個問題? OrderedDict
和ordereddict
之間是否有差別,是否來自collections
?
版本2.7中的OrderedDict' [出現](https://docs.python.org/2/library/collections.html#collections.OrderedDict)。 – skovorodkin
相關:[OrderedDict爲舊版本的Python](http://stackoverflow.com/questions/1617078/ordereddict-for-older-versions-of-python) – Wondercricket
閱讀罰款[文檔](https:// docs。 python.org/2/library/collections.html?highlight=Equivalent#collections.OrderedDict),它告訴你它在什麼版本中被引入,以及在哪裏可以找到**版本的**等價OrderedDict配方**。 – martineau