本文共 444 字,大约阅读时间需要 1 分钟。
Python3 中可以使用 json 模块来对 json 数据进行编解码,它包含了两个函数[1]:
在json的编解码过程中,python 的原始类型与json类型会相互转换,具体的转化对照如下:
Python | JSON |
---|---|
dict | object |
list, tuple | array |
str | string |
int, float, int- & float-derived Enums | number |
True | true |
False | false |
None | null |
JSON | Python |
---|---|
object | dict |
array | list |
string | str |
number (int) | int |
number (real) | float |
true | True |
false | False |
null | None |
[1]
转载地址:http://vtswb.baihongyu.com/