ちょうべんり。
In [1]: '{0:03d}'.format(2)
Out[1]: '002'
In [2]: '{0:03d}'.format(2000)
Out[2]: 2000
空白地も埋められる。
In [3]: '{0:3d}'.format(2)
Out[3]: ' 2'
Go to list of users who liked
More than 5 years have passed since last update.
ちょうべんり。
In [1]: '{0:03d}'.format(2)
Out[1]: '002'
In [2]: '{0:03d}'.format(2000)
Out[2]: 2000
空白地も埋められる。
In [3]: '{0:3d}'.format(2)
Out[3]: ' 2'
Register as a new user and use Qiita more conveniently
Go to list of users who liked