问题描述:

I found that if I use round function to some float values, it is OK to round to two decimals, but sometimes, for example, round(myvalu,2) it will return 1.2 instead of 1.20, but actually I want every returned value is rounded to two decimals, i.e. 1.20 instead of 1.2. what should I do?

网友答案:

That's something you'd do when displaying the number.

Try

'%.2f' % num
相关阅读:
Top