[Tutor] re.sub() query

Payal payal-python at scriptkitchen.com
Sun Jun 20 11:54:13 CEST 2010


Hi,
Is it possible to solve the below, w/o making a re object?

>>> a
'Mary Had a Little Lamb'
>>> p=re.compile('l',re.I)
>>> re.sub(p,'-',a)
'Mary Had a -itt-e -amb'

I cannot figure how to se re.I w/o involving  p.

Thanks.
With warm regards,
-Payal
-- 





More information about the Tutor mailing list