Python format 格式化函数

https://www.runoob.com/python/att-string-format.html

print(1263/3722630510000) #0.3392762187920611
ret='{:.2%}'.format(1263/37226305) #百分之 #0.00%
print(ret)print('%.2f'%(1263/37226305
10000)+'‱') #0.34‱
print('{:.2f}'.format(1263/37226305*10000)+'‱') #0.34‱

posted @ 2020-01-14 23:19  hanfe1  阅读(191)  评论(1编辑  收藏  举报