You can download this code by clicking the button below.
This code is now available for download.
The function is used to pad a string to a specified width, using a specified character to fill the insufficient part.
Technology Stack : str.zfill(width)
Code Type : String formatting function
Code Difficulty : Beginner
def zfill(string, width=0, fillchar=' '):
return str(string).zfill(width)