1.访问菜鸟教程(https://www.runoob.com),爬取其Python3实例模块的题目内容,要求输出格式如下图所示。
【答案】
import requests from lxml import etree import time # 获取题目链接 url = 'https://www.runoob.com/python3/python3-examples.html' web_data = requests.get(url) dom = etree.HTML(web_data.text, etree.HTMLParser(encoding='utf-8')) # 网页解析 exerciseList= |