can you add some more info, or point me to a link, i havn't found anything about binary search in mmap() in python documents.
the files are very big... thanks amit Bill Scherer wrote: > noro wrote: > > >Is there a more efficient method to find a string in a text file then: > > > >f=file('somefile') > >for line in f: > > if 'string' in line: > > print 'FOUND' > > > >? > > > >BTW: > >does "for line in f: " read a block of line to te memory or is it > >simply calls f.readline() many times? > > > >thanks > >amit > > > > > If your file is sorted by some key in the data, you can build a very > fast binary search with mmap in Python. -- http://mail.python.org/mailman/listinfo/python-list