import urllib.request
url = 'http://www.csdn.net'
response = urllib.request.urlopen(url)
print(str(response.read()))
with open('E:\Python文件\爬虫\CSDN.html\csdnhtml.html','w') as f:
f.write(str(response.read()))
问题:为什么会写入“ b'' ”?不应该写入csdn的html源代码吗?怎么处理?