ftp retrlines with re...
__peter__ at web.de
Mon Dec 8 11:40:15 CET 2008
isabellknauer at googlemail.com wrote:
This does not do what you think it does.
Help on method retrlines in module ftplib:
retrlines(self, cmd, callback=None) unbound ftplib.FTP method
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.
I. e. you would need something like
lines = 
to store the method's output in a variable instead of printing it to stdout.
files = server.nlist()
instead which gives you a list of filenames.
PS: Remember to take Gabriel's advice to heart for your next question.
More information about the Python-list