1

I need to download files from the internet. For that I am using subprocess and calling wget. Is this the right way? The files are hosted on static links and there is no need to log in or anything.

I glanced over urllib but I could not find any example of it being used to download files of other types.

Any suggestions?

1 Answer 1

6

Other than what?

urllib.urlretrieve(url)

should work fine for any filetype. You will often want to specify a filename, rather than use a temp file (the default):

urllib.urlretrieve(url, filename)

There are several other libraries too, but this is fine for basic uses.

Sign up to request clarification or add additional context in comments.

1 Comment

I thought urllib was for getting only HTML files and then logging in somehow. I will admit I didn't RTM.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.