Python float to Decimal conversion

后端 未结 9 1955
渐次进展
渐次进展 2020-12-05 03:50

Python Decimal doesn\'t support being constructed from float; it expects that you have to convert float to a string first.

This is very inconvenient since standard

9条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-05 04:44

    When you say "preserving value as the user has entered", why not just store the user-entered value as a string, and pass that to the Decimal constructor?

提交回复
热议问题