# 第一个爬虫程序 import urllib.request # 1.指定url url = "https://www.sogou.com/" # 2.发起请求,拿到请求对象 response = urllib.request.urlopen(url=url) # 3.获取页面数据 page = response.read() # 4.持久化存储 with open("./sogou.html", "wb") as fp: fp.write(page)
找到当前的html文件打开即可