Fill in the front with 0 to adjust the string length to width
"3".zfill(5)
"50000".zfill(5)
"723".zfill(723)
Fill in the front with fillchar
to set the string length to width
"5".rjust(5, '0')
print ("%05d"% 5)
print (format (5000,05')) #2.6 or higher
print ('{0:05d}'.format (273) #2.6 or later
© 2025 OneMinuteCode. All rights reserved.