I have two strings I need to make equivalent length:
str1 ='AVFGHJK'
str2 ='ADF'
I need to append some 0s to the end of str2 so it becomes length equivalent to str1:
str1 ='AVFGHJK'
str2 ='ADF0000'
Output:
str2 ='ADF0000'
I have tried to use zfill, but it adds zeros to the beginning of the string, not the end.
>Solution :
Use str.ljust fo padding char
print("ABC".ljust(8, '0')) # ABC00000
And str.rjust for leading char
print("ABC".rjust(8, '0')) # 00000ABC