0

When I try to convert a decimal.Decimal to a string, sometimes Python will output scientific notation (e.g. "123E-2").

>>> from decimal import Decimal
>>> str(Decimal('0.00'))
'0.00'
>>> str(Decimal('0.0000000'))
'0E-7'

How can I ensure the output is always in decimal notation (e.g. "1.23")?

Theron Luhn
  • 3,936
  • 3
  • 35
  • 47

0 Answers0