Equivalent of 'wget' for python?

alex23 wuwei23 at gmail.com
Thu Dec 11 05:01:45 EST 2008


On Dec 11, 7:36 pm, hrishy <hris... at yahoo.co.uk> wrote:
> urllib -->static class
> request -->method
> urlretrieve--> what is this then ?

The easiest way is to check for yourself, using type().

So 'type(urllib)' should give you '<type 'module'>' (assuming the same
types as 2.5, I don't have an install of 3.0 handy atm). My guess is
'type(urllib.request)' will be the same, and 'type
(urllib.request.urlretrieve)' will be '<type 'function'>'.

'urllib' is a module, or most likely in this case a package, which is
a folder that can be treated as a module. It contains another module,
'request', which has inside the function 'urlretrieve'.

Modules & packages are a handy language feature for placing
functionality into namespaces. The documentation is worth checking
out: http://docs.python.org/3.0/tutorial/modules.html



More information about the Python-list mailing list