code_junkie

python float to Decimal conversion

Nov 12th, 2011
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.12 KB | None | 0 0
  1. "%.15g" % f
  2.  
  3. format(f, ".15g")
  4.  
  5. >>> repr(1.5)
  6. '1.5'
  7. >>> repr(12345.678901234567890123456789)
  8. '12345.678901234567'
Add Comment
Please, Sign In to add comment