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‱

原文地址:https://www.cnblogs.com/hanfe1/p/12194588.html