[Tutor] Lists in a file
David Holland
davholla2002 at yahoo.co.uk
Sun Apr 26 20:03:41 CEST 2009
Hi,
I am trying to create a program where I open a file full of lists and process them.
However when the program does not recognize the lists as lists.
Here is the relevant code :-
def open_filedef():
text_file =open ("voteinp.txt","r")
lines = text_file.readlines()
for line in lines:
print line
print line[0]
text_file.close()
And an example of the type of text :-
['a','b','c']
['e','d','f']
Any ideas?
Thanks in advance
David Holland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090426/550921f1/attachment.htm>
More information about the Tutor
mailing list