Change default float print format

后端 未结 7 547
无人共我
无人共我 2020-12-01 16:44

I\'ve some lists and more complex structures containing floats. When printing them, I see the floats with a lot of decimal digits, but when printing, I don\'t need all of th

7条回答
  •  情深已故
    2020-12-01 17:01

    Upgrade to Python 3.1. It doesn't use more digits than necessary.

    Python 3.1.2 (r312:79147, Apr 15 2010, 15:35:48) 
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 0.1
    0.1
    

提交回复
热议问题