format () function

By {} and Format ":"% instead.
Format before and after the mapping relationship
by location
Here Insert Picture Description
keyword

Here Insert Picture Description
By subscript
Here Insert Picture Description
format specifier:
placed inside the {}
Here Insert Picture Description
Here Insert Picture Description

Here Insert Picture Description
Among English simultaneous lead to uneven how to do, with spaces *
such as: "{0:^10}\t{1:{3}^10}\t{2:^10}".format(u[0],u[1],u[2],chr(12288))
use format template:
tplt = "{0:^10}\t{1:{3}^10}\t{2:^10}"
print(tplt.format("排名","学校名称","总分",chr(12288)))

Published 67 original articles · won praise 36 · views 70000 +

Guess you like

Origin blog.csdn.net/qq_41861526/article/details/104078645