本文摘自php中文网,作者Tomorin,侵删。
Demjson 是 python 的第三方模块库,可用于编码和解码 JSON 数据,包含了 JSONLint 的格式化及校验功能。Github 地址:https://github.com/dmeranda/demjson
官方地址:http://deron.meranda.us/python/demjson/
环境配置
在使用 Demjson 编码或解码 JSON 数据前,我们需要先安装 Demjson 模块。本教程我们会下载 Demjson 并安装:
1 2 3 |
|
更多安装介绍查看:http://deron.meranda.us/python/demjson/install
JSON 函数
encode
Python encode() 函数用于将 Python 对象编码成 JSON 字符串。
语法
1 |
|
实例
以下实例将数组编码为 JSON 格式数据:
1 2 3 4 5 6 |
|
以上代码执行结果为:
1 |
|
以上就是demjson python如何安装?简介dem指标的用法的详细内容,更多文章请关注木庄网络博客!!
相关阅读 >>
更多相关阅读请进入《Python》频道 >>

Python编程 从入门到实践 第2版
python入门书籍,非常畅销,超高好评,python官方公认好书。