Round number to nearest integer

前端 未结 11 2131
傲寒
傲寒 2020-11-27 12:32

I\'ve been trying to round long float numbers like:

32.268907563;
32.268907563;
31.2396694215;
33.6206896552;
...

With no success so far. I

11条回答
  •  青春惊慌失措
    2020-11-27 13:13

    Use round(x, y). It will round up your number up to your desired decimal place.

    For example:

    >>> round(32.268907563, 3)
    32.269
    

提交回复
热议问题