python regex substitution with backreferences, don't forget to escape!

    amount = re.sub(r'\.(\d)0$', '.\1', amount)

wont work but...

    amount = re.sub(r'\.(\d)0$', '.\\1', amount)

will!

0
Your rating: None