Drop-Trailing-Zzeros-from-Decimal Python
>>> s = str(Decimal('1500'))
>>> print s.rstrip('0').rstrip('.') if '.' in s else s
1500
Busy Boar
>>> s = str(Decimal('1500'))
>>> print s.rstrip('0').rstrip('.') if '.' in s else s
1500
def remove_exponent(num):
return num.to_integral() if num == num.to_integral() else num.normalize()
>>> print decimal.Decimal('5.500')
5.500
>>> print decimal.Decimal('5.500').normalize()
5.5