Which JSON module can I use in Python 2.5?

后端 未结 6 656
自闭症患者
自闭症患者 2020-12-15 02:19

I would like to use Python\'s JSON module. It was only introduced in Python 2.6 and I\'m stuck with 2.5 for now. Is the particular JSON module provided with Python 2.6 avail

6条回答
  •  自闭症患者
    2020-12-15 02:49

    I am programming in Python 2.5 as well and wanted a suitable library. Here is how I did it.

    donwloaded the simplejson egg file called simplejson-2.0.6-py2.5-linux-i686.egg from http://pypi.python.org/simple/simplejson/

    installed it using the command :

    sudo python ./ez_setup.py ./simplejson-2.0.6-py2.5-linux-i686.egg

    Then imported the json library into the script file by doing :

    import sys
    sys.path.append("/home/coolkid/Android/simplejson/simplejson-2.0.6-py2.5-linux-i686.egg")
    try: import simplejson as json
    except ImportError: print ("import error")
    

提交回复
热议问题