Python格式化输出指定宽度及占位符

时间:2020-06-25 19:44:11   收藏:0   阅读:454
1 {:08}.format(11)
2 
3 
4 
5 mat = "{:020}\t{:028}\t{:032}"
6 print(mat.format(1,2, 3))

冒号后面指定输出宽度,:后的0表示用0占位。

out:

1 00000011
2 
3 
4 Name:Aviad      Age:00000025 Height:00001.83

 

原文:https://www.cnblogs.com/jiangkejie/p/13192602.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!