我有一个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语法。 –