在这里,我想将一个“大”字典转储到 json 中,如下所示:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
doc = {}
# appending the doc, so that the doc is more than 2G
.....
json_doc = json.dumps(doc)
然后我收到以下错误消息:
File "C:\Python27\lib\site-packages\simplejson\__init__.py", line 286, in dump
s
return _default_encoder.encode(obj)
File "C:\Python27\lib\site-packages\simplejson\encoder.py", line 228, in encod
e
chunks = list(chunks)
MemoryError
我该如何解决?谢谢!