Reading just a few lines from a text file

tkpmep at tkpmep at
Wed Aug 24 00:07:55 CEST 2005

Right now my code reads as follows:

for line in reversed(infile.readlines()):  #Search from the bottom up
     if int(line.split()[0]) == MyDate:
           Data= float(line.split()[-1])

I have to read about 10,000 files, each with data. I'm looking to speed
up each individual file open/close cycle.

Thomas Philips

More information about the Python-list mailing list