from fake_useragent import UserAgent import requests from lxml import etree def takeurl(): headers={ 'User-Agent':UserAgent().random } url='https://www.qqxsnew.com/95/95819/' nodes=etree.HTML(requests.get(url,headers=headers).content) data =nodes.xpath("/h...
import requests, json def main(): # 参数 cityname = input("请输入你想查询的城市天气:") key = '2e2883171ff8e8b957793be62b2ec56c' get_weather( cityname, key) def get_weather( cityname, key): url = 'http://api.tianapi.com/txapi/tianqi/index' params = 'city={}&key={}'.for...
import requests, json def main(): # 参数 cityname = input("请输入你想查询的城市天气:") key = '2e2883171ff8e8b957793be62b2ec56c' get_weather( cityname, key) def get_weather( cityname, key): url = 'http://api.tianapi.com/txapi/tianqi/index' params = 'city={}&key={}'.for...