python 格式化string (““.format)

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

保留小数点后两位
:.2f
"{:s}, Time:{:.2f}min, Size:{:.2f}Gb".format(id, idTime/1000/60, idDirSize/1024/1024/1024)
'd00001, Time:10.31min, Size:1.47Gb'
posted @ 2022-03-20 21:38  bH1pJ  阅读(80)  评论(0编辑  收藏  举报