On Mar 23, 4:40 pm, valpa <[email protected]> wrote: > I only need the 3 digits after '.' > > Is there any way other than converting from/to string?
I'm not sure if this is the canonical way but it works:
>>> d = Decimal('1.23456789')
>>> three_places = Decimal('0.001') # or anything that has the exponent depth
>>> you want
>>> d.quantize(three_places, 'ROUND_DOWN')
Decimal('1.234')
--
http://mail.python.org/mailman/listinfo/python-list
