In [159]: a
Out[159]:
{'AveryJL': 4,
'Railgunsssss': 8,
u'SWER\u5fae': 4,
u'TMD\u6b7b\u5ea6\u5a18': 8,
'airman1': 4,
'csh841486967': 4,
'oi99o': 4,
'uwookim': 4,
'wy101574658': 8,
'zzz1230456789': 4,
u'\u4e03\u591c\u8bd7\u5e0c': 4,
u'\u4e3f\u521d\u97f3Kong': 4,
u'\u4e50\u56ed\u7684\u53a8\u5e08\u957f': 4,
u'\u51b3\u65ad\u795e\u66f2': 4,
u'\u58c1\u5427\u5427\u52a1\u7ec4': 4,
u'\u6211\u662f\u6700\u840c\u7684\u5b69\u6b62': 4,
u'\u6c64\u67d2\u67d2': 8,
u'\u6dfa\u77b3Rory': 4,
u'\u756a\u7ec4\u767e\u79d1': 8,
u'\u83cabishi': 16,
u'\u865a\u6570\u9b54\u672f': 4,
u'\u94c3\u4e0e\u601c\u7269\u8bed': 4}
In [160]: pickle.dumps(a)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-160-ffc7f744baa1> in <module>()
----> 1 pickle.dumps(a)
c:\python27\lib\pickle.pyc in dumps(obj, protocol)
1378 def dumps(obj, protocol=None):
1379 file = StringIO()
-> 1380 Pickler(file, protocol).dump(obj)
1381 return file.getvalue()
1382
c:\python27\lib\pickle.pyc in dump(self, obj)
222 if self.proto >= 2:
223 self.write(PROTO + chr(self.proto))
--> 224 self.save(obj)
225 self.write(STOP)
226
c:\python27\lib\pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
c:\python27\lib\pickle.pyc in save_dict(self, obj)
653
654 self.memoize(obj)
--> 655 self._batch_setitems(obj.iteritems())
656
657 dispatch[DictionaryType] = save_dict
c:\python27\lib\pickle.pyc in _batch_setitems(self, items)
666 if not self.bin:
667 for k, v in items:
--> 668 save(k)
669 save(v)
670 write(SETITEM)
c:\python27\lib\pickle.pyc in save(self, obj)
329
330 # Save the reduce() output and finally memoize the object
--> 331 self.save_reduce(obj=obj, *rv)
332
333 def persistent_id(self, obj):
c:\python27\lib\pickle.pyc in save_reduce(self, func, args, state, listitems, di
ctitems, obj)
423
424 if state is not None:
--> 425 save(state)
426 write(BUILD)
427
c:\python27\lib\pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288
c:\python27\lib\pickle.pyc in save_dict(self, obj)
653
654 self.memoize(obj)
--> 655 self._batch_setitems(obj.iteritems())
656
657 dispatch[DictionaryType] = save_dict
c:\python27\lib\pickle.pyc in _batch_setitems(self, items)
667 for k, v in items:
668 save(k)
--> 669 save(v)
670 write(SETITEM)
671 return
c:\python27\lib\pickle.pyc in save(self, obj)
304 reduce = getattr(obj, "__reduce_ex__", None)
305 if reduce:
--> 306 rv = reduce(self.proto)
307 else:
308 reduce = getattr(obj, "__reduce__", None)
c:\python27\lib\copy_reg.pyc in _reduce_ex(self, proto)
68 else:
69 if base is self.__class__:
---> 70 raise TypeError, "can't pickle %s objects" % base.__name__
71 state = base(self)
72 args = (self.__class__, base, state)
TypeError: can't pickle _Element objects