Fixed width number formatting python 3

后端 未结 3 414
Happy的楠姐
Happy的楠姐 2021-01-31 19:06

How do I get an integer to fill 0\'s to a fixed width in python 3.2 using the format attribute? Example:

a = 1
print(\'{0:3}\'.format(a))

gives

3条回答
提交回复
热议问题