python String completion fills in fixed length ( A filling ) Three ways
text justification
Zero compensation , You can make up for something else :
'''
Align the left side of the original string , Right zero padding :
'''
str.ljust(width,'0')
input: '789'.ljust(32,'0')
output: '78900000000000000000000000000000'
'''
Align the right side of the original string , Zero filling on the left side :
Method 1 :
'''
str.rjust(width,'0')
input: '798'.rjust(32,'0')
output: '00000000000000000000000000000798'
'''
Method 2 :
'''
str.zfill(width)
input: '123'.zfill(32)
output:'00000000000000000000000000000123'
'''
Method 3 :
'''
'%07d' % n
input: '%032d' % 89
output:'00000000000000000000000000000089'