Home > php教程 > php手册 > Python 操作 json

Python 操作 json

WBOY
Release: 2016-06-06 20:00:33
Original
1359 people have browsed it

1、安装 pip install simplejson 2、实例 import simplejson as json # 转换成json串 json. dumps (['foo', {'bar': ('baz', '白菜', 1.0, 2)}]) # json 解析 obj = json. loads ( ['foo', {'bar': ('baz', '白菜', 1.0, 2)}]) print obj[0] # 结果为: foo

1、安装

      pip install simplejson


2、实例

     import simplejson as json


     # 转换成json串

     json.dumps(['foo', {'bar': ('baz', '白菜', 1.0, 2)}])

    

    # json 解析

    obj = json.loads("['foo', {'bar': ('baz', '白菜', 1.0, 2)}]")

    print obj[0]  # 结果为: foo


来源: https://pypi.python.org/pypi/simplejson

===================  请关注  ========================

                                           Python 操作 json

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template