[Tutor] Searching list items.

Chris Hengge pyro9219 at gmail.com
Tue Oct 17 23:47:31 CEST 2006


contents = readlines(myfile, 'r')
Ok, I'm under the impression this is a list of strings (array)
How in the world do I cycle through them looking for words?

for line in contents:
     if line.contains("something")
         print line

Thats a mock up of what I'm looking for.
I tried to figure out how to use re, but that spits out locations in memory
or none it seems.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061017/8dac5801/attachment.htm 


More information about the Tutor mailing list