方法一:
:<{} 左对齐 :^{} 中间对齐 :>{} 右对齐
对齐符号后面的{}表示变量的总宽度
print("{:<{}} {:<{}} {:<{}}".format("yifu",25, "chenyichenyi",50, 0.23655,20))
yifu chenyichenyi 0.23655方法二:
数字对应上面的总宽度,s表示字符串,10f.8取10位,保留8位小数位
print("{:<25s} {:<50s} {:<10f.8}".format("yifu", "chenyichenyi", 0.23655))
yifu chenyichenyi 0.23655000
下一篇:js实现圆形菜单选择器的方法