[Tutor] how to read from a txt file

jrlen balane nbbalane at gmail.com
Mon Feb 14 00:51:58 CET 2005


and this line:
     data_points.append(int(line))

this would turn the string back to an integer, am i right?

and on this one:
    data_points = [ int(line) for line in data_file ]

this did not use any read(), is this already equal to readline()? so
this would already store all the data in the txt file to
data_points[], am i right?

thank you guys! ei, you two are not competing, are you? anyway, hope
its a friendly one. for the benifit of all those newbie like me,
hehehe.


More information about the Tutor mailing list