Jan 2, 2013

Reading a File with line numbers


file = open("read.txt","r")
text = file.readlines()
file.close()

counter = 1
for line in text:
    print counter, line,
    counter = counter +1
print

No comments:

Post a Comment