Equivalent of 'wget' for python?

R

Robert Dailey

Hi,

I'm looking for a portable way to download ZIP files on the internet
through Python. I don't want to do os.system() to invoke 'wget', since
this isn't portable on Windows. I'm hoping the core python library has
a library for this. Note that I'll be using Python 3.0.

Thanks.
 
D

Diez B. Roggisch

Robert said:
Hi,

I'm looking for a portable way to download ZIP files on the internet
through Python. I don't want to do os.system() to invoke 'wget', since
this isn't portable on Windows. I'm hoping the core python library has
a library for this. Note that I'll be using Python 3.0.

Module urllib2

Diez
 
R

r0g

Robert said:
Hi,

I'm looking for a portable way to download ZIP files on the internet
through Python. I don't want to do os.system() to invoke 'wget', since
this isn't portable on Windows. I'm hoping the core python library has
a library for this. Note that I'll be using Python 3.0.

Thanks.


urllib.urlretrieve(url_of_zip_file, destination_on_local_filesystem).

There's also a third argument you can use to link a progress update
function of your choosing if you need it.


Roger.
 
J

Jerry Hill

urllib.urlretrieve(url_of_zip_file, destination_on_local_filesystem).

In python 3.0, that appears to be:

import urllib.request
urllib.request.urlretrieve(url, local_file_name)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top