python format格式化字符串、格式化数字
数字格式化
https://www.runoob.com/python/att-string-format.html
下表展示了 str.format() 格式化数字的多种方法:
>>> print("{:.2f}".format(3.1415926)) 3.14
'{:b}'.format(11)
'{:d}'.format(11)
'{:o}'.format(11)
'{:x}'.format(11)
'{:#x}'.format(11)
'{:#X}'.format(11)
|
1011
11
13
b
0xb
0XB
|
a='{:05d}.jpg' print(a.format(1)) result:00001.jpg