[Tutor] how to get a line text from input file.

Alan Gauld alan.gauld at freenet.co.uk
Wed Mar 22 09:30:15 CET 2006


> i am new to programming language and python. I wonder how to get a line 
> text
> from input file.

f = open('somefile.txt')
line = f.readline()

For more details on using files see the Handling Files topic in my web 
tutor.

Alan G
Author of the learn to program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld




More information about the Tutor mailing list