String format function uses

#format string concatenation, the parameter (in) the format of the object must be iterative 
P1 = " I AM {2}, {Age. 1}, {0} " .format ( " Seven " , 18 is, ' Alex ' ) Print (TP1) TP1 = " I AM. 1 {}, Age {}. 1 " .format ( " Seven " , 18 is, ' Alex ' ) # parameter according neuron progenitor subscript Print (TP1) TP1 = " I AM {name}, } {Age Age, Really {name} " .format (name = " Tang " , Age = 20 is) # according to the key value of the dictionary,name for the dictionary key name Print (TP1) TP1 = " I AM {name}, Age Age {}, {name} Really " .format (** { " name " : " Seven " , " Age " : 18 is}) # ** according dictionary keys to value, name for the dictionary key name Print (TP1) Print ( Help (format) )

 

Guess you like

Origin www.cnblogs.com/tangcode/p/10965568.html