发布时间:2019-09-12 07:54:16编辑:auto阅读(1967)
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}
上一篇: Python-day3作业-haprox
下一篇: python 3 用户输入和格式化输出
 51194
 50609
 41233
 38051
 32513
 29420
 28281
 23136
 23094
 21432
 1489°
 2202°
 1825°
 1753°
 2064°
 1813°
 2499°
 4193°
 4055°
 2894°