Pierre Quentel:
> If the line number of the first line is 0 :
> source=open('afile.txt')
> for i,line in enumerate(source):
> if i == line_num:
> break
> print line
I don't know if something like this can be called an improvement:
from itertools import islice
afile = file('data.txt')
line_n = 10
print islice(afile, line_n, line_n+1).next()
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
