ftplib LIST question

Emile van Sebille emile at fenx.com
Tue Aug 6 00:21:02 EDT 2002


Al:
> I'm interested in parsing the output of retrlines('LIST') via a
callback
> routine, e.g., retrlines('LIST',mycallbackroutine()).  I'm an absolute
> python newbie, but I'm pretty experienced with regular expressions so
> I'm not so concerned with carving up the lines once I get them... my
> immediate problem is what special variable (or whatever... something
> like the perl $_ maybe?) represents each line in the context of the
> callback routine.

Call it whatever you like.  Here I used line:

>>> def func(line): print line
...
>>> ftp.retrlines('LIST', func)
total 350944
-rw-------    1 emile    emile       13800 Aug  4 13:04 .bash_history
-rw-r--r--    1 emile    emile          24 Apr 27  2000 .bash_logout
-rw-r--r--    1 emile    emile         262 Jul 30  2000 .bash_profile
-rw-r--r--    1 emile    emile         124 Apr 27  2000 .bashrc


HTH

--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list