Page Hit Counter Vandalism & Writing FTP Results

Martin Franklin mfranklin1 at gatwick.westerngeco.slb.com
Thu May 16 05:54:06 EDT 2002


On Wednesday 15 May 2002 7:44 pm, Peter F. Ferris wrote:
>
>     	countff = str((ftp.retrlines('retr default.asp.cnt')))
> 	ftp.retrlines('retr default.asp.cnt')
>     	print "countff var is: ", countff
>



Peter, 

pydoc ftplib    
...... <snip>
     |  retrlines(self, cmd, callback=None)
     |      Retrieve data in line mode.
     |      The argument is a RETR or LIST command.
     |      The callback function (2nd argument) is called for each line,
     |      with trailing CRLF stripped.  This creates a new port for you.
     |      print_line() is the default callback.

print_line being a function in ftplib that errrr prints the line to stdout!
so.....  you need to use that second argument... somthing like 


data=[]    # empty list to store your data in!


# append method called  for every 'line' in the remote file
ftp.retrlines('retr default.asp.cnt', data.append)   

Cheers
Martin








More information about the Python-list mailing list