ftplib callbacks

Matija Papec mpapec at yahoo.com
Sun Nov 21 10:32:04 EST 2004


I would like to reimplement ftplib "nlst" using ftplib.dir (ftp server
doesn't support nlst) so I'm trying to guess how to use ftp callbacks.
Any help is appreciated.
tia!

============
#!/usr/bin/python

# nlst vs list

import pprint
pp = pprint.PrettyPrinter(indent=4)

import ftplib

def myfilter(line):
        return line

ftp = ftplib.FTP("localhost")
ftp.login("mpapec", "island88")
#print ftp.retrlines("LIST")
dir = ftp.dir("", myfilter)
print dir


-- 
Matija



More information about the Python-list mailing list