efficient text file search.

Luuk luuk at invalid.lan
Mon Sep 11 07:31:45 EDT 2006


"noro" <amit.man at gmail.com> schreef in bericht 
news:1157973527.817462.207420 at h48g2000cwc.googlegroups.com...
> 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'
>


yes, more efficient would be:
grep (http://www.gnu.org/software/grep/)






More information about the Python-list mailing list