There are tons of topics on here that explain how to convert a string to a decimal, but how do I convert a decimal back to a string?
Like if I did this:
import decimal
dec = decimal.Decimal('10.0')
How would I take dec
and get '10.0'
(a string) out?
Use the str()
builtin, which:
Returns a string containing a nicely printable representation of an object.
E.g:
>>> import decimal
>>> dec = decimal.Decimal('10.0')
>>> str(dec)
'10.0'