"""
使用python调用请求
使用pip install requests安装requests
"""
import jsonimport requestsresp = requests.get(url='https://apis.tianapi.com/tianqi/index',params={'key': '4a9ce7c2516a223ewe323dwe323ew323eq1', 'city': '101020100', 'type': 1}
)
dict = json.loads(resp.text)
print(dict)
new_dict = dict['result']
print(new_dict)
date = new_dict['date']
week = new_dict['week']
print(date)
print(week)