把百度网页源代码爬取下来代码:
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()
把百度网页源代码爬取下来代码:
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()