1 Star 0 Fork 0

hsj-xiaokang / python

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
json_test.py 424 Bytes
一键复制 编辑 原始数据 按行查看 历史
hsj-xiaokang 提交于 2022-09-01 16:08 . 重新复习python
#!/usr/bin/env python
import json
'''
json字符串和dic字典互相转(python语言提供)
'''
def test_json_func():
dic = {'a': 123, 'b': 456}
print(dic)
# 转json字符串
dic_str = json.dumps(dic)
print(dic_str)
# json字符串转dic
dic_str_original = '{"a": "qwe", "b": "456"}'
dic = json.loads(dic_str_original)
print(dic)
if __name__ == '__main__':
test_json_func()
1
https://gitee.com/hsjjsh123/python.git
git@gitee.com:hsjjsh123/python.git
hsjjsh123
python
python
master

搜索帮助