[Tutor] Searching list items.

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Wed Oct 18 00:07:23 CEST 2006



> I remove those lines, but I was trying to use
> for line in contents:
>   result = re.search("something", line)
>   print result

'result' here is going to either be None, as you've seen, or a "match" 
object.  We have several options available to use once we have a 
match.  Take a look at a few of the methods in here:

     http://www.python.org/doc/lib/match-objects.html

Printing a match object itself won't be too informative.  What would you 
like to show up if there is some match?


More information about the Tutor mailing list