Downloading a picture via urllib and python

后端 未结 18 1575
离开以前
离开以前 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:17

    Python 2

    Using urllib.urlretrieve

    import urllib
    urllib.urlretrieve("http://www.gunnerkrigg.com//comics/00000001.jpg", "00000001.jpg")
    

    Python 3

    Using urllib.request.urlretrieve (part of Python 3's legacy interface, works exactly the same)

    import urllib.request
    urllib.request.urlretrieve("http://www.gunnerkrigg.com//comics/00000001.jpg", "00000001.jpg")
    

提交回复
热议问题