We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
d = {'a':123,'b':'456','c':'xyz'} print(d) ## {'a': 123, 'b': '456', 'c': 'xyz'} print(type(d)) ## <class 'dict'> import json json_str = json.dumps(d) ## json.dumps 字典->json print(json_str) ## {"a": 123, "b": "456", "c": "xyz"} print(type(json_str)) ## <class 'str'> d1 = json.loads(json_str) ## json.loads json->字典 print(d1) ## {'a': 123, 'b': '456', 'c': 'xyz'} print(type(d1)) ## <class 'dict'>
使用dumps函数可以将字典转换为JSON字符串,使用loads函数可以将JSON字符串转换为字典。
dumps
loads
The text was updated successfully, but these errors were encountered:
No branches or pull requests
使用
dumps
函数可以将字典转换为JSON字符串,使用loads
函数可以将JSON字符串转换为字典。The text was updated successfully, but these errors were encountered: