re - multiple results
Michael Hoffman
cam.ac.uk at mh391.invalid
Fri Jun 10 19:59:45 EDT 2005
Pingveno wrote:
> I'm working on the Python Challenge (make sure to try it:
> http://www.pythonchallenge.com). One of the puzzles requires the use of
> regular expressions, but with multiple matches in the text. I tried to
> use re.findall(), but I only go one result instead of a list of results.
>
>>>>print re.findall(r"myexpression",text)
>
> ['AZBaCTR']
>
> Or is it not a function issue?
Works for me. Although I usually prefer this idiom:
re_something = re.compile(r"pattern")
re_something.findall(text)
You're doing something else wrong.
--
Michael Hoffman
More information about the Python-list
mailing list