Need script to download file at known address

phansen peter at engcorp.com
Fri Sep 17 08:05:15 EDT 2004


Jeff Shannon wrote:
> Radioactive Man wrote:
>> Are there any variants of the "open" commmand that
>> allow location (drive and directory) of the file to be specified as
>> well, for example, if I wanted to save the file as
>> "D:\binaries\trash.gif" instead of the default location?
> 
> As a matter of fact, the standard open() will handle that just fine -- 
> it accepts a pathname, rather than just a filename, so you can feed it 
> an absolute path like your example or a relative path ...

But note that the directories have to exist already.  If they don't,
you need to use something like os.makedirs() to get 'em.

-Peter



More information about the Python-list mailing list