我有一個hang子手遊戲,我正在嘗試使用一個字典爲我的hang子手類別,所以我沒有神奇的數字,但每當我嘗試創建一個字典時: cat{animals:'animals', colors: 'colors'}
等等。返回類似不可能的類型:列表。Python Dict分類
1
A
回答
4
animals
或colors
可能是一個列表。我認爲你有字典倒退(例如,切換鍵/值的順序,以便您將鍵字符串映射到列表值):
animals = ['cat','dog','liger']
d = {'animals':animals}
+0
謝謝,mgilson,當我有這麼小的錯誤時,我討厭它。 – AlexSwearingen
+0
@ user2329136 - 發生在我們身上。 – mgilson
相關問題
- 1. Python dir(dict)vs dir(dict .__ class__)
- 2. Dict Python代碼
- 3. python list into dict
- 4. python dict set min_size
- 5. python - Letter Count Dict
- 6. Python Dict Set類初始化程序
- 7. map :: lower_bound()等價於python的dict類嗎?
- 8. Python列表與dict
- 9. python dict setdefault,困惑
- 10. python 3 self class dict
- 11. 分配NoneType與dict
- 12. 什麼是dict類用於
- 13. python 3.3 dict:如何將struct PyDictKeysObject轉換爲python類?
- 14. Python dict的鄰接表
- 15. 的Python頭的Unicode與dict
- 16. python iter over dict-like object
- 17. 變換分配與dict
- 18. 類似dict的東西在c
- 19. 如何有效地提取python n-nested dict的葉/分支值?
- 20. 如何在python 3.2中分塊csv(dict)閱讀器對象?
- 21. dict(映射,** kwargs)vs dict(可迭代,** kwargs)
- 22. 覆蓋Python中的__setitem__ dict子類不能用於設置
- 23. python「dict」類型的源代碼在哪裏?
- 24. 有沒有像python中的所有類似dict的方法?
- 25. dict.get(self,key)在擴展python的類中是什麼Dict
- 26. Python Dict不止一個最大值
- 27. python SyntaxError with dict(1 = ...),但{1:...}工作
- 28. python list/dict屬性最佳做法
- 29. Python的 - 通過dict`s字典價值
- 30. Python - dump dict作爲json字符串
您可以請發佈您確切的事情嗎?你發佈的內容是無效的Python語法。 –