find string in file

Lie Lie.1296 at gmail.com
Sun Mar 16 10:12:39 CET 2008


On Mar 14, 8:25 pm, fminerv... at gmail.com wrote:
> Hi friends !!
>
> I'm neophite about python, my target is to create a programa that
> find  a specific string in text file.
> How can do it?
>
> Thanks
> fel

I'd recommend regular expression (import re) if the string you're
searching is in a complex format (like all strings that starts with a
dollar sign followed by an arbitrary number of numbers which might or
might not contain commas every three number).

If what you're searching is just simple queries (like searching where
"Hello" appeared in the text you'd better use the string modules. as
they're simpler to use and faster.



More information about the Python-list mailing list