Equivalent string.find method for a list of strings
jeremit0
jeremit0 at gmail.com
Fri Apr 8 15:37:42 EDT 2005
harold fellermann wrote:
> file.readlines() returns a list of lines. You can either call find on each
> element in this list, like:
>
> for line in myfile.readlines() :
> if line.find('my particular string') :
> do_something()
>
I had thought that may be the only way to do it, I was hoping for
something simpler as I wrote earlier.
Thanks for your help,
Jeremy
More information about the Python-list
mailing list