[Tutor] Equivalent of grep in python

ppaarrkk simon_ecc at yahoo.co.uk
Sun Dec 21 03:02:33 CET 2008


The following works :

file1 = open (file0, "r")

re.findall ( 'some_text', file1.readline() )


But this doesn't :

re.findall ( 'some_text', file1.readlines() )



How do I use grep for a whole text file, not just a single string ?
-- 
View this message in context: http://www.nabble.com/Equivalent-of-grep-in-python-tp21111356p21111356.html
Sent from the Python - tutor mailing list archive at Nabble.com.



More information about the Tutor mailing list