Look for a string on a file and get its line number

Jeroen Ruigrok van der Werven asmodai at in-nomine.org
Tue Jan 8 03:59:50 EST 2008


-On [20080108 09:51], John Machin (sjmachin at lexicon.net) wrote:
>Make that >=
>
>| >>> 'fubar'.find('fu')

Or even just:

if 'my-string' in line:
   ...

Same caveat emptor applies though.

-- 
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/
We're walking this earth. We're walking this shining earth...



More information about the Python-list mailing list