format函数取三位小数

number = 1.231564
print('{:.3f}'.format(number))

posted @ 2021-09-12 20:33  zty666  阅读(172)  评论(0)    收藏  举报