#------------------------爬取python100例-方法一-函数式编程-----------------
# # http://www.runoob.com/python/python-100-examples.html
# import requests
# import re
# from lxml import etree
# def get_html(url):
# try:
# headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0'}
# response=requests.get(url,headers=headers,timeout=20)
# if response.status_code==200:
# return response.content.decode("utf-8")
# else:
# print("返回状态码错误!!!")
# except Exception as e:
# print("请求出现错误,错误类型是%s"%e)
#
# def parse_html(html):
# # pass
# pattern = re.compile('<h1>Pyth.*(练习实例\d+)</h1>.*?<p><strong>(题目.*?)</strong>(.*?)</p>'