import urllib.request
import gevent
from gevent import monkey
def downloder(img_name,img_url):
req = urllib.request.urlopen(img_url)
img_content = req.read()
with open(img_name,'wb') as f:
f.write(img_content)
def main():
gevent.joinall([
gevent.spawn(downloder,'2.jpg','插入图片链接'),
gevent.spawn(downloder,'3.jpg','插入图片链接'),
gevent.spawn(downloder,'4.jpg','插入图片链接')
])
main()
网络爬取图片
最新推荐文章于 2024-03-25 13:55:15 发布