"Bryan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> is there a way to make the Decimal class not print the exponent version of the
> decimal?
>
>
>  >>> str(Decimal('1010'))
> '1010'
>  >>> str(Decimal((0, (1, 0, 1), 1)))
> '1.01E+3'
>  >>>
>
> how do you make the 2nd example print 1010?


The quantize method will convert to any desired exponent (zero in your example):

>>> d = (Decimal((0, (1, 0, 1), 1)))
>>> d
Decimal("1.01E+3")
>>> d.quantize(Decimal(1))
Decimal("1010")



Raymond Hettinger


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to