出错提示:
Traceback (most recent call last):
File "C:\Users\xiejian\AppData\Local\Programs\Python\Python35-32\test180305.py", line 5, in <module>
f.write(content)
TypeError: write() argument must be str, not bytes
修改为:
from urllib import request
web=request.urlopen(r'http://www.baidu.com')
content=str(web.read())
f=open('baidu.html','w')
f.write(content)
f.close()