1.数值格式化,并定义为浮点型float
‘数值:{:a}’.format(a) 相当于 f'数值:{a:f}'
2.取整:
math.floor(123.9)=123,地板,向下取整
math.ceil(123.01)=124,天花板,向上取整
round(123,125,2)=123.13,保留2位小数,四舍五入
1.数值格式化,并定义为浮点型float
‘数值:{:a}’.format(a) 相当于 f'数值:{a:f}'
2.取整:
math.floor(123.9)=123,地板,向下取整
math.ceil(123.01)=124,天花板,向上取整
round(123,125,2)=123.13,保留2位小数,四舍五入