Chobenri.
In [1]: '{0:03d}'.format(2) Out[1]: '002' In [2]: '{0:03d}'.format(2000) Out[2]: 2000
Blank areas are also filled.
In [3]: '{0:3d}'.format(2) Out[3]: ' 2'
Recommended Posts