【爬虫】 02 将爬取到的网页写入文件中

import urllib.request

# 在执行过程中,会产生缓存
urllib.request.urlretrieve('http://www.mingxing.com/',filename=r'D:\pypypy\space\18\1.txt')
# 清除缓存
urllib.request.urlcleanup()
print('已清除')
发布了96 篇原创文章 · 获赞 103 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_38114487/article/details/104707550