<p>我一直在尝试将长浮点数四舍五入,比如:</p>
<pre><code>32.268907563;
32.268907563;
31.2396694215;
33.6206896552;
...
</code></pre>
<p>至今没有成功。我试过<code>math.ceil(x)</code>,<code>math.floor(x)</code>(尽管这会向上或向下取整,这不是我要找的)和<code>round(x)</code>这两种方法都不起作用(仍然是浮点数)。</p>
<p>我能做什么?</p>
<p>编辑:代码:</p>
<pre><code>for i in widthRange:
for j in heightRange:
r, g, b = rgb_im.getpixel((i, j))
h, s, v = colorsys.rgb_to_hsv(r/255.0, g/255.0, b/255.0)
h = h * 360
int(round(h))
print(h)
</code></pre>