python json dumps() loads()
2021-07-26 00:55
标签:div pytho style code class int pre 转换 json dumps() 转换成json loads() 转换成dict python json dumps() loads() 标签:div pytho style code class int pre 转换 json 原文地址:https://www.cnblogs.com/luckygxf/p/15042256.htmlimport json
dict = {‘a‘: ‘wo‘, ‘b‘: ‘zai‘, ‘c‘: ‘zhe‘, ‘d‘: ‘li‘}
string = json.dumps(dict)
loads = json.loads(string)
print("type(string):", type(string))
print("type(loads):", type(loads))
print("string:", string)
print("loads:", loads)
type(string): class ‘str‘>
type(loads): class ‘dict‘>
string: {"a": "wo", "b": "zai", "c": "zhe", "d": "li"}
loads: {‘a‘: ‘wo‘, ‘b‘: ‘zai‘, ‘c‘: ‘zhe‘, ‘d‘: ‘li‘}
文章标题:python json dumps() loads()
文章链接:http://soscw.com/index.php/essay/106971.html