# 1、requests里面自带解析器转字典
print(r.json())
print(type(r.json()))
# 取出json中的'result_sk_temp'字段
# {"resultcode":"200","reason":"查询成功","result":{"sk":{"temp":"28","wind_direction":"东南风","wind_strength":"2级"
result = r.json()["result"]['sk']['temp']
print(result)
# 2、json模块转字典
import json
print(json.loads(r.text)) # json格式的str转dict
print(type(json.loads(r.text)))
# 查看返回内容,是字典格式才能转json
# html不能转成json
print(r.json()['reason'])
print(r.json()['result']['today']['weather'])