tags:

views:

46

answers:

1

Hi.

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?

+5  A: 

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.

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