In this post we will be creating a script that will add padding to a string, a script as such could be useful when trying to format output or ensuring your output are all of the same number of characters.
For example we have an ID ‘145’ although we want our output to be eight characters in length. Refer to the code below which would add padding to the ID.
id = '145' print(id.zfill(8))
The code above would output the following which is eight characters in length with the padding applied.