python 格式化string (““.format) python 字符 格式 字符串可视化

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

{:0>2d}   宽度为2,前边补0

 

保留小数点后两位
{:.2f}
"{:s}, Time:{:.2f}min, Size:{:.2f}Gb".format(id, idTime/1000/60, idDirSize/1024/1024/1024)
'd00001, Time:10.31min, Size:1.47Gb'
 aaa = [f"{i+1:0>3d}" for i in range(99)]

posted @ 2021-06-18 09:02  bH1pJ  阅读(23)  评论(0编辑  收藏  举报