【发布时间】:2017-10-08 12:28:13
【问题描述】:
我在 python 中创建了一个类,如下所示:
class myClass():
_fields_ = [1, 2]
其中 field_1 和 field_2 应该是整数。
然后我创建了一个数组,其元素属于 myClass 类,如下所示:
array = [ myClass() for i in range(5)]
当我想在变量检查器中检查 array 元素的值时,它给了我以下消息:
"Spyder was unable to retrieve the value of this variable from the console."
"The error message was: Object array is not picklable"
我的问题是:如何检查数组元素的值?
【问题讨论】:
-
为什么标题中有“graph”,问题中有“array”?这两个词的意思完全不同。
-
如果您使用 python 2 扩展
class myClass(object)可能就足够了。 (语法提示:类名以大写字母开头)。 -
@stovfl Spyder 版本是 2.3.7
-
@ImanolLuengo 我做了你建议的编辑,但仍然无法检查变量检查器中的数组。
标签: python arrays class pickle spyder