码迷,mamicode.com
首页 > 其他好文 > 详细

format 进阶

时间:2020-04-30 09:38:13      阅读:49      评论:0      收藏:0      [点我收藏+]

标签:strong   ros   sof   控制   text   mat   pre   family   enter   

‘‘‘format(数字,str(算术式)+"d或者f")
    d 表示 int
    f 表示 float
‘‘‘
format(5,str(2*4)+"d")
‘       5‘

format(5,str(2*4)+"f")
‘5.000000‘
‘‘‘使用 .2f 控制小数点个数‘‘‘
format(5,str(2*4)+".2f")
‘    5.00‘
format(5,str(2*15)+"f")
‘                      5.000000‘

‘‘‘format(字符串,str(算术式)+"s")‘‘‘
format(‘s‘,str(2*3)+"s")
‘s     ‘

2020-04-30

format 进阶

标签:strong   ros   sof   控制   text   mat   pre   family   enter   

原文地址:https://www.cnblogs.com/hany-postq473111315/p/12806654.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!