Skip to content

Latest commit

 

History

History
30 lines (14 loc) · 237 Bytes

python.number.md

File metadata and controls

30 lines (14 loc) · 237 Bytes

python 数字常用方法

一、数字转字符串

str(1232)
'1232'

二、四舍五入

a = 123.2322

print(round(a, 2)) #保留2位

print("{:.2f}".format(2.685))
123.23
2.69