Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 将其除以某个值后设置精确值_Python 3.x - Fatal编程技术网

Python 3.x 将其除以某个值后设置精确值

Python 3.x 将其除以某个值后设置精确值,python-3.x,Python 3.x,当我除以3/4时,需要精确的值1。那么,如何在python中使用精确值进行取整。它应该是1,而不是1.0、0.75或0 print(3/4) = 0.75 print(3//4) = 0 尝试使用内置的无精度数字: >>> print(round(3/4)) 1

当我除以3/4时,需要精确的值1。那么,如何在python中使用精确值进行取整。它应该是1,而不是1.0、0.75或0

print(3/4) = 0.75
print(3//4) = 0
尝试使用内置的无精度数字:

>>> print(round(3/4))
1