Python 官方文档:入门教程 => 点击学习
python语言之Print输出方法Print 输出方法: '-' 表示左对齐 '+' 表示正号 '0' 表示用0填充 'f' 前指定一个最小宽度 '.' 指定小数点后的精度 格式:% [flag][width][.precision]ty
python语言之Print输出方法
Print 输出方法:
'-' 表示左对齐
'+' 表示正号
'0' 表示用0填充
'f' 前指定一个最小宽度
'.' 指定小数点后的精度
格式:% [flag][width][.precision]typecode
方法1:
1.num = 7.9 print 'the num is %f' % num
2.num = 7.9 num2 = 10 print 'the num is %f and %d' % (num,num2)
3.num = 7.9 num2 = 10 print 'the num is %f and %d' % (num,3)
方法2:
4.num = 7.9 num2 = 10 print 'the nums is {0} and {1} . fORMat{num,num2}
方法3:
lang = "Python"
print "I love %(program)s" % {"program": lang}
--结束END--
本文标题: Python 自动化运维3-Print输
本文链接: https://www.lsjlt.com/news/189328.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0