drop trailing zeros from decimal python

Solutions on MaxInterview for drop trailing zeros from decimal python by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "drop trailing zeros from decimal python"
Serena
10 Nov 2016
1>>> s = str(Decimal('1500'))
2>>> print s.rstrip('0').rstrip('.') if '.' in s else s
31500