import urllib.request url = ‘http://www.baidu.com/‘ response = urllib.request.urlopen(url) data = response.read() str_data = data.decode(‘utf_8‘) # print(str_data) with open(‘baidu.html‘,‘w‘,encoding=‘utf_8‘) as f: f.write(str_data)
原文地址:https://www.cnblogs.com/xlsxls/p/9930066.html
时间: 2024-10-14 20:09:45