爬虫学习

把百度网页源代码爬取下来代码:
from urllib.request import urlopen
url = "http://www.baidu.com"
resp = urlopen(url)
with open("my.html",mode="w",encoding="utf-8") as f:
f.write(resp.read().decode("utf-8"))
print("好了")
resp.close()
原文地址:https://www.cnblogs.com/092e/p/14954948.html