str(1).zfill(2) # 1 will be '01' str(23).zfill(4) # 23 will be '0023'
Here is what the above code is Doing:
1. str(1) is converting the integer 1 to a string.
2. .zfill(2) is adding 0s to the left of the string, so that it is 2 characters long.
3. str(23) is converting the integer 23 to a string.
4. .zfill(4) is adding 0s to the left of the string, so that it is 4 characters long.