时间:2021-07-01 10:21:17 帮助过:28人阅读
class Writer: def __init__(self, file): self.f = open(file, "w") def __call__(self, data): self.f.write(data) self.f.write('\n') print data FILENAME = "AutoIndent.py" writer = Writer(FILENAME) import ftplib ftp = ftplib.FTP('127.0.0.1', 'book', 'bookpw') ftp.retrlines("RETR %s" % FILENAME, writer)
希望本文所述对大家的Python程序设计有所帮助。