Starting from Python 2.6, a new function called str. format() was added to format strings, which enhances the functionality of string formatting.
The format function can accept an unlimited number of parameters, with positions that are not in order.
"{1} {0} {1}".format("hello", "world")
'world hello world'
The optional parameters inside the box {} are as follows:

An example is as follows:
print("{:.2f}".format(3.1415926))
#3.14
s='python'
print("{0:c>10}".format(s))
#ccccpython
s='python'
print("{0:3}".format(s))
#python automatically compensate when slot width is less than string length