JSON module for python 2.4?

后端 未结 3 1005
春和景丽
春和景丽 2021-02-05 06:13

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

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-05 06:36

    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
    

提交回复
热议问题