把 Python 对象转换为 JSON 字符串
- import json
- print(json.dumps({"name": "Bill", "age": 63}))
- print(json.dumps(["apple", "bananas"]))
- print(json.dumps(("apple", "bananas")))
- print(json.dumps("hello"))
- print(json.dumps(42))
- print(json.dumps(31.76))
- print(json.dumps(True))
- print(json.dumps(False))
- print(json.dumps(None))