场景:
写采集工具时获取到response,需要转换为python字典
Tips:
response = requests.get(url)
data_1 = response.json()
data_2 = json.loads(response.text)
这里data1和data2是一样的.
response.json() 是requests这个第三方库提供的将json数据转换成python 字典的方法.
json.loads(text) 是 python 内置的将json数据转换成python字典的方法。
参考:
https://www.zhihu.com/question/414216978/answer/1408435165