Search snippets
Browse Code Answers
FAQ
Usage docs
Log In
Sign Up
Home
Python
drop-trailing-zeros-from-decimal python
bigranga
Programming language:
Python
2021-06-03 02:34:09
0
Q:
drop-trailing-zeros-from-decimal python
Nanigashi
Code:
Python
2021-06-16 23:52:55
>>> s = str(Decimal('1500')) >>> print s.rstrip('0').rstrip('.') if '.' in s else s 1500
0
Tags
python
zeros
trailing
trailing zeros
Related
regular expression to remove space python
python - remove floating in a dataframe
remove after and before space python
remove decimal python
remove leading and lagging spaces dataframe python
remove trailing and leading spaces in python
python binary remove 0b
remove 0th row pandas
how to add extra zeros after decimal in python
remove multiple space python
what error happens in python when i divide by zero
pandas remove repeated index
New to Communities?
Join the community