Oct-21-2022, 09:46 PM
Well, I just looked at decimal module docs.
I think the normalize method is what you need.
I think the normalize method is what you need.
In [1]: import decimal In [2]: num = decimal.Decimal('37.0') In [3]: num.normalize() Out[3]: Decimal('37') In [4]: num = decimal.Decimal('37.1') In [5]: num.normalize() Out[5]: Decimal('37.1') In [6]: num = decimal.Decimal('37') In [7]: num.normalize() Out[7]: Decimal('37')