1

I am making a simple application in Python that downloads a file from a website. This application has to put said file in a specific location.

      import urllib
      urllib.urlretrieve ("http://www.example.com/songs/mp3.mp3", "mp3.mp3")

In the above code, which I got from an answer on the question, How do I download a file over HTTP using Python?, I am guessing that "mp3.mp3" is the file that will be stored locally after it is downloaded from the URL. That brings me to my next question: can I put a filepath and then the file name/extension in place of "mp3.mp3"?

Community
  • 1
  • 1
J. Royal
  • 21
  • 3

2 Answers2

0

Yes, that is how it works. The documentation for urllib can be found here.

ahalbert
  • 474
  • 1
  • 6
  • 15
0

There's a lot of great information here, but in addition:

urllib.request.urlretrieve('http://www.google.com', 'dir\\to\\wherever')
Matt
  • 437
  • 3
  • 10