Download file from web in Python 3

前端 未结 9 670
星月不相逢
星月不相逢 2020-11-22 16:43

I am creating a program that will download a .jar (java) file from a web server, by reading the URL that is specified in the .jad file of the same game/application. I\'m usi

9条回答
  •  不知归路
    2020-11-22 17:27

    Here we can use urllib's Legacy interface in Python3:

    The following functions and classes are ported from the Python 2 module urllib (as opposed to urllib2). They might become deprecated at some point in the future.

    Example (2 lines code):

    import urllib.request
    
    url = 'https://www.python.org/static/img/python-logo.png'
    urllib.request.urlretrieve(url, "logo.png")
    

提交回复
热议问题