reading data from a file

dave white dwhite2 at seas.upenn.edu
Wed Apr 5 03:20:36 CEST 2000


Hello, can anyone please help with these basic questions:

1)  I'm using file.readlines() to read in some data.  Is there any quick
and efficient way to automatically get rid of the endofline '\012'
character that gets appended to the strings at the end of every line?

2)  Is there a way for python to read a line from a file in such a way
that it knows its a collection data type and not just a string? i.e.
read something like [[1,2][3,4][5,6]] and know its a list of lists?

thanks...
david



More information about the Python-list mailing list