Decimal printing without the exponent

B

Bryan

is there a way to make the Decimal class not print the exponent version of the
decimal?


how do you make the 2nd example print 1010?

i know i can do this, but i thought i could make the Decimal class convert the
string directly.

i tried the to_eng_string() and to_sci_string() but that didn't work. does
anyone know how to do this?


thanks,

bryan
 
R

Raymond Hettinger

Bryan said:
is there a way to make the Decimal class not print the exponent version of the
decimal?



how do you make the 2nd example print 1010?


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



Raymond Hettinger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top