0.150,保留2位小数四舍五入
def Rounding(_float, _len):
try:
if str(_float).split(".")[1][_len] == '5':
return (round(float(str(_float)[:-1] + '6'), _len))
else:
return (round(_float, _len))
except:
return((_float))
a=0.150
print(Rounding(a,2))
0.15