Downloading a picture via urllib and python

后端 未结 18 1677
离开以前
离开以前 2020-11-22 10:35

So I\'m trying to make a Python script that downloads webcomics and puts them in a folder on my desktop. I\'ve found a few similar programs on here that do something simila

18条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-22 11:15

    Just for the record, using requests library.

    import requests
    f = open('00000001.jpg','wb')
    f.write(requests.get('http://www.gunnerkrigg.com//comics/00000001.jpg').content)
    f.close()
    

    Though it should check for requests.get() error.

提交回复
热议问题