Hi,
given this code:
from ftplib import FTP
connection = FTP('ftp.python.org')
connection.login()
connection.dir()
connection.close()
The script write on the standart output a list of files and directories
present on the server. Good. But how can I have this output in a string
that I can work with ? sys.stdout is an open file object, is'nt it ?
So if I do :
string_out = sys.stdout.readlines()
the script of course freeze. (what is for me logic)
How can I solve the problem ?
Why connection.sendcmd('ls') does not work ? the same for
connection.sendcmd('LIST') ? 'ls' is a valid ftp command. In the RFC of
FTP the commands are differents as the one I use every day : no get,
mget, put, mput, ... but LIST, RETR, ... what is the difference ?
Thanks for your help
Antoine