import urllib.request
import gevent
from gevent import monkey
monkey.patch_all()
def dowload(img_name,img_url):
req = urllib.request.urlopen(img_url)
image_content = req.read()
with open(img_name,"wb") as f:
f.write(image_content)
def main():
gevent.joinall([
gevent.spawn(dowload,"D:/one.jpg","https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=2946256743,2518786199&fm=58&bpow=826&bpoh=1240"),
gevent.spawn(dowload,"D:/two.jpg","https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=2946256743,2518786199&fm=58&bpow=826&bpoh=1240"),
])
if __name__ == "__main__":
main()