import json a = {'a':'1111','b':'2222','c':'3333','d':'4444'} jsObj = json.dumps(a) print(jsObj) print(type(a)) print(type(jsObj))运行结果是: A: {"a": "1111", "b": "2222", "c": "3333", "d": "4444"} <class 'dict'> <class 'dict'> B: {"a": "1111", "b": "2222", "c": "3333", "d": "4444"} <class 'str'> <class 'str'> C: {"a": "1111", "b": "2222", "c": "3333", "d": "4444"} <class 'dict'> <class 'str'> D: {"a": "1111", "b": "2222", "c": "3333", "d": "4444"}<class 'str'><class 'dict'>
import json a = {'a':'1111','b':'2222','c':'3333','d':'4444'} jsObj = json.dumps(a) print(jsObj) print(type(a)) print(type(jsObj))运行结果是: A: {"a": "1111", "b": "2222", "c": "3333", "d": "4444"} <class 'dict'> <class 'dict'> B: {"a": "1111", "b": "2222", "c": "3333", "d": "4444"} <class 'str'> <class 'str'> C: {"a": "1111", "b": "2222", "c": "3333", "d": "4444"} <class 'dict'> <class 'str'> D: {"a": "1111", "b": "2222", "c": "3333", "d": "4444"}<class 'str'><class 'dict'>
1