import math #default print "PI = %f" % math.pi #width = 10,precise = 3,align = left print "PI = %10.3f" % math.pi #width = 10,precise = 3,align = rigth print "PI = %-10.3f" % math.pi #前面填充字符 print "PI = %06d" % int(math.pi) #输出结果 #PI = 3.141593 #PI = 3.142 #PI = 3.142 #PI = 000003 #浮点数的格式化,精度、度和