[EMAIL PROTECTED] on 11 Feb 2007 08:16:11 -0800 didst step forth and proclaim thus:
> More concisely: > > import re > > pattern = re.compile(r'\b324\b') > indices = [ match.start() for match in > pattern.finditer(target_string) ] > print "Indices", indices > print "Count: ", len(indices) > Thank you, this is educational. I didn't realize that finditer returned match objects instead of tuples. > Cheers, > Steven > -- Sam Peterson skpeterson At nospam ucdavis.edu "if programmers were paid to remove code instead of adding it, software would be much better" -- unknown -- http://mail.python.org/mailman/listinfo/python-list