-*- coding = utf-8 -*-
a = "I am Python print test"
b = "I am %s %s %s" % ("Python","print","test")
c = "I am {} {} {}".format("Python","print","test")
d = "I am {0} {1} {2}".format("Python","print","test")
e = "I am {1} {2} {0}".format("Python","print","test")
f = "I am {who} {which} {where}".format(who="Python",which="print",where="test")
h= "this is %(where)s %(fruit)s" % {'where':'my','fruit':'apple'}
print (f);
print (a);
print (b);
print (c);
print (d);
print (e);
print (f);
转载于:https://blog.51cto.com/suxin/1871413