爬图片

作者: 我的好昵称 | 来源:发表于2019-07-02 22:19 被阅读0次

    import urllib.request
    import gevent
    from gevent import monkey

    monkey.patch_all()

    def downloader(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(downloader,"3.png","https://rpic.douyucdn.cn/asrpic/190702/96291
    _2126.png"),

    image
    gevent.spawn(downloader,"2.png","https://rpic.douyucdn.cn/asrpic/190702/5551871_2128.png"),
    
    image
    ])
    if name == 'main':
    main()

    相关文章

      网友评论

        本文标题:爬图片

        本文链接:https://www.haomeiwen.com/subject/bpjxhctx.html