How can I replace foobar
with foo123bar
?
This doesn't work:
>>> re.sub(r'(foo)', r'1123', 'foobar')
'J3bar'
This works:
>>> re.sub(r'(foo)', r'1hi', 'foobar')
'foohibar'
I think it's a common issue when having something like
umber
. Can anyone give me a hint on how to handle this?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…