[Tutor] getting original pattern from regular expression object
Rich Lovely
roadierich at googlemail.com
Tue Apr 20 04:33:03 CEST 2010
On 20 April 2010 03:25, Tino Dai <oberoc at gmail.com> wrote:
> If I have:
>
> import re
> a=re.compile('foo')
>
> is there a way to get the original pattern of foo from the object a?
>
> Thanks,
> Tino
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
a.pattern:
>>> import re
>>> a = re.compile("foo")
>>> a.pattern
'foo'
--
Rich "Roadie Rich" Lovely
Just because you CAN do something, doesn't necessarily mean you SHOULD.
In fact, more often than not, you probably SHOULDN'T. Especially if I
suggested it.
10 re-discover BASIC
20 ???
30 PRINT "Profit"
40 GOTO 10
More information about the Tutor
mailing list