ftputil.py

Miki miki.tebeka at gmail.com
Wed May 24 04:07:43 EDT 2006


Hello Sheldon,

> Here is the part of the program that I need explained:
>
> host.download(name, name, 'b')  # remote, local, binary mode
Download file called "name" from host to a local file in the same name,
use binary mode.

> source = host.file('index.html', 'r')  # file-like object
Open a file (like built-in "open") on remote site in read mode

> target = host.file('newdir/index.html', 'w')  # file-like object
Open a file (like built-in "open") on remote site in write mode

> host.copyfileobj(source, target)  # similar to shutil.copyfileobj
Copy 1'st file to the second.

HTH,
Miki
http://pythonwise.blogspot.com/




More information about the Python-list mailing list