[Tutor] HELP-Regarding python

Dave Angel davea at davea.name
Wed Jan 30 07:57:50 CET 2013


On 01/30/2013 01:51 AM, Gayathri S wrote:
> Hi All....!
>                   I don't know how to read text file in python. If the data
> values are stored in a text file format, for example(1,30,60,90,120...200)
> means what i would do for reading it in python. could you just explain it.
>
>

infile = open("filename", "rt")    will open a text file

line = infile.readline()        will read one line from it, as a str

After that, you can parse it anyway you like.




-- 
DaveA


More information about the Tutor mailing list