JSON module for python 2.4?

久未见 提交于 2019-12-31 18:55:11

问题


I'm accustomed to doing import json in Python 2.6, however I now need to write some code for Python 2.4. Is there a JSON library with a similar interface that is available for Python 2.4?


回答1:


The json module in Python 2.6 is mostly the same as the simplejson third-party module, which is available for Python 2.4 as well. You can just do:

try:
    import json
except ImportError:
    import simplejson as json



回答2:


Now, a few years later, simplejson does only support python 2.5+. No more simplejson for systems stuck on 2.4. Even though it is not supported, you may find older packages on pypi. 2.0.9 or 2.1.0 should work.

pip install simplejson==2.1.0

(I could not comment on the chosen answer, but this just bit me hard, so it may be useful to others as well)




回答3:


I needed to get this up on an old box with Python 2.4.3. Used simplejson-1.7-py2.4.egg from here:

https://pypi.python.org/packages/2.4/s/simplejson/



来源:https://stackoverflow.com/questions/3291682/json-module-for-python-2-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!