I have written a little program that takes as input a text file,
converts
it to a list with appropriate html coding (making it into a nice
table).
Finally I want to upload this list as a textfile using ftp.
If homeworkhtml contains the list of lines;
e.g. homeworkhtml = ["<table>", "<tr>", "<td>", "test", "</td>" .....
I want to call:
ftp.storlines("STOR " + filename, homeworkhtml)
which gives me the error
Traceback (most recent call last):
File "./testhw.py", line 67, in ?
ftp.storlines("STOR " + filename, homeworkhtml)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/ftplib.py", line 428, in storlines
AttributeError: 'list' object has no attribute 'readline'
Expected since homeworkhtml is in fact not a file. Is there a way
to convert this list to a file object without first writing it to disc
and
then opening the resulting file?
Best,
Bart