Is there a simple way to make lists behave as files (with ftplib)
Posted
by Brent.Longborough
on Stack Overflow
See other posts from Stack Overflow
or by Brent.Longborough
Published on 2010-03-17T09:45:55Z
Indexed on
2010/03/17
9:51 UTC
Read the original article
Hit count: 324
I'd like to use ftplib to upload program-generated data as lists. The nearest method I can see for doing this is ftp.storlines, but this requires a file object with a readlines() method.
Obviously I could create a file, but this seems like overkill as the data isn't persistent.
Is there anything that could do this?:
session = ftp.new(...)
upload = convertListToFileObject(mylist)
session.storlines("STOR SOMETHING",upload)
session.quit
© Stack Overflow or respective owner