You can download this code by clicking the button below.
This code is now available for download.
This function is used to pad a string to a specified width. If the length of the string is less than the specified width, it will be padded with the specified character on the left.
Technology Stack : str.zfill(width)
Code Type : String operation
Code Difficulty : Intermediate
def zfill(string, width, fillchar=' '):
return str(string).zfill(width)