Pyhton爬虫爬取天气情况以及情话
获取北京城区天气信息 #!/usr/bin/python # -- coding: utf-8 -- # @Time : 2020/5/1 16:11 # @Author : cuijianzhe # @File : weather.py # @Software: PyCharm from datetime import datetime import urllib.request from lxml import etree def getWeather(): url = "http://www.weather.com.cn/weather/101010100.shtml" response = urllib.request.urlopen(url) HTML = response.read().decode() parseHtml = etree.HTML(html) temperatureLow = ''.join(parseHtml.xpath('//*[@id="7d"]/ul/li[1]/p[2]/i/text()')) # 获取今天最低温度 temperatureHi....