[Tutor] Newbie: Passing variable into re.compile
Jerome Jabson
jjabson at yahoo.com
Thu Mar 30 00:38:11 CEST 2006
Hello,
Iâm having trouble trying to pass a variable into
re.compile(), using the ârâ option. Letâs say I
have the following:
import re
arg1 = â10â
p = re.compile(r + arg1 + '\.(\d+\.\d+\.\d+)')
This works if I do:
p = re.compile(r â10\.(\d+\.\d+\.\d+)')
Is there something special I need to do for the
ârâ option? Like escape it when using a variable?
Thanks,
Jerome
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Tutor
mailing list