开发者

Downloading files using Python

I need to download files from the internet. For that开发者_StackOverflow 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜