【1】%格式化和format格式化
1)%的格式化
a = "i am %s" % "alex"
a = "i am %s age %d " % ("alex",18)
a = "i am %(name)s age %(age)d" % {"name":"alex","age":18}
a = "percent %.2f" % 99.98234
a = "i am %(pp).2f" % {"pp":123.3245}
a = "i am %.2f %%" % {"pp":123.3223455}
2)format格式化
a = "i am {},age {}".format("seven",18,"alex")
b = "i am {},age {}, {}".format(*["seven", 18 ,"alex"])
c = "i am {0}, age {1}, really {0}".format("seven", 18)
d = "i am {0}, age{1}, really {0}".format(*["seven", 18])