= TPL " I AM {name}, Age Age {}, {name} Really " .format (name = " Seven " , Age = 18 is )
Print (TPL) # I AM Seven, Age 18 is, must correspond Seven Really otherwise, an error
TPL = " I AM {name}, Age Age {}, {name} Really " .format (** { " name " : " Seven " , " Age " : 18 is })
# to pass the dictionary must ** plus two, otherwise it will error, the role of supra
Print (tpl) # i AM Seven, Age 18, for Really Seven,
tpl = "{2} AM I, Age {. 1}, {0} Really " .format ( " Seven " , 18 is, ' Alex ' )
Print (TPL) # I AM Alex, Age 18 is, Really Seven
TPL = " I AM {: } S, Age {:} D " .format (* [ " Seven " , 18 is ])
# * indicates a list is passed,: s refers to the incoming string,: d refers to the incoming digital
Print ( TPL) # I AM Seven, Age 18 is
TPL = " I AM {: S}, Age {:} D " .format ( " Seven " , 18 is) # [ "Seven",18]
print(TPL) # I AM Seven, Age 18 is
L = [ " Seven " , 18 is ]
TPL = " I AM {: S}, Age {:} D " .format ( ' Seven ' , 18 is )
Print (TPL) # I Seven AM, Age 18 is
TPL = " Numbers: {: B}, {: O}, {: D}, {: X}, {: X-}, {:%}, {} " .format (15, 15, 15, 15, 15, 15.87623, 2 )
# : binary means B,: o means octal,: x \ X refers hex:% refers to a percentage display
Print (TPL) # Numbers: 1111,17,15, f, F, 1587.623000%, 2