Entry
How do I store the result of retrlines into a variable?
Mar 11th, 2007 23:43
Utkarsh Upadhyay, Eric Wood,
ftplib.FTP.retrlines(cmd,callback=None) takes two arguments, as the help
says.
The default callback is the print_line(), which prints the results.
You can call your own function here which takes an argument and appends
the entry to an existing list.
Sample code:
ftp=ftplib.FTP('the.host.name')
ftp.login('username','passwd')
lines=[]
ftp.retrlines('RETR filename.txt',lambda x:lines.append(x))