I am trying to replace single $
characters with something else, and want to ignore multiple $
characters in a row, and I can't quite figure out how. I tried using lookahead:
s='$a $$b $$$c $d'
re.sub('$(?!$)','z',s)
This gives me:
'za $zb $$zc zd'
when what I want is
'za $$b $$$c zd'
What am I doing wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…