fn = 'G:\\pythonProject\\result.txt' import requests url = 'http://www.163.com' string = requests.get(url) with open(fn,'w') as file_obj: file_obj.write(string.text.encode('gbk', 'ignore').decode('gbk'))
python 获取网页并将其保存至文本文件中
最新推荐文章于 2021-06-19 16:24:08 发布