regex alternation problem

Robert Kern robert.kern at
Sat Apr 18 00:01:40 CEST 2009

On 2009-04-17 16:57, Eugene Perederey wrote:
> According to documentation re.findall takes a compiled pattern as a
> first argument. So try
> patt = re.compile(r'(am|an)')
> re.findall(patt, s1)
> re.findall(patt, s2)

No, it will take a string pattern, too.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the Python-list mailing list