reading specific lines of a file
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Sun Jul 16 04:34:04 EDT 2006
In message <mailman.8213.1152993897.27775.python-list at python.org>, Yi Xing
wrote:
> I want to read specific lines of a huge txt file (I know the line #).
> Each line might have different sizes. Is there a convenient and fast
> way of doing this in Python? Thanks.
file("myfile.txt").readlines()[LineNr]
Convenient, yes. Fast, no. :)
More information about the Python-list
mailing list