How to FTP a ASCII file

Adonis Vargas adonis at REMOVETHISearthlink.net
Mon Jul 2 19:07:26 EDT 2007


tedpottel at gmail.com wrote:
> Hi,
> 
> My program has the following code to transfer a binary file
> 
>         f = open(pathanme+filename,'rb')
>         print "start transfer"
>         self.fthHandle.storbinary('STOR '+filename, f)
> 
> How can I do an ASCII file transfer??????
> -Ted
> 

Taken from online documentation:

http://docs.python.org/lib/ftp-objects.html

storlines(command, file)

Store a file in ASCII transfer mode. command should be an appropriate 
"STOR" command (see storbinary()). Lines are read until EOF from the 
open file object file using its readline() method to provide the data to 
be stored.

Hope this helps.

Adonis



More information about the Python-list mailing list