import urllib.request
import gevent
from gevent import monkey
def downloader(img_name,img_url):
req = urllib.request.urlopen(img_url)
img = req.read()
with open(img_name,"wb") as f:
f.write(img)
def main():
gevent.joinall([
gevent.spawn(downloader,'01.jpg.',//'photocdn.tv.sohu.com/img/20181122/vrsa_hor_1542854674142_9522819_t39s2_pic28.jpg"')
gevent.spawn(downloader,'02.jpg','//photocdn.tv.sohu.com/img/20180614/vrsa_hor_1528959586706_9434506_W3160_pic28.jpg')
])
if __name__=='__main__':
main()
网友评论