read line by line : readline « File « Python Tutorial






f = open(r'c:\test.txt')
for i in range(3):
        print str(i) + ': ' + f.readline(),
f.close()








12.11.readline
12.11.1.read line by line
12.11.2.Reading and printing a file.