标签:浮点 对齐 http 字符 label 浮点数 hit sheng print
>>> print "I‘m %s" % ("jihite") I‘m jihite
>>> print "I‘m %d years old" % (17) I‘m 17 years old
>>> print "π=%f" % (3.1415926) π=3.141593
>>> print "π=%.3f" % (3.1415926) π=3.142
>>> print "NAME:%8s AGE:%8d WEIGHT:%8.2f" % ("jihite", 17, 62.2) NAME: jihite AGE: 17 WEIGHT: 62.20
>>> print "NAME:%-8s AGE:%-8d WEIGHT:%-8.2f" % ("jihite", 17, 62.2) NAME:jihite AGE:17 WEIGHT:62.20
>>> print "NAME:%-8s AGE:%08d WEIGHT:%08.2f" % ("jihite", 17, 62.2) NAME:jihite AGE:00000017 WEIGHT:00062.20
>>> format(0.0000023, ‘.2e‘) ‘2.30e-06‘ >>> format(0.23, ‘.2e‘) ‘2.30e-01‘
转载:http://www.cnblogs.com/kaituorensheng/p/5545650.html
标签:浮点 对齐 http 字符 label 浮点数 hit sheng print
原文地址:http://www.cnblogs.com/mologa-jie/p/7792635.html