[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