You can download this code by clicking the button below.
This code is now available for download.
Right-justify a string within a given width. Pad with the specified fill character if the string is shorter than the specified width.
Technology Stack : Built-in string method
Code Type : String operation
Code Difficulty :
def zfill(string, width=0, fillchar=' '):
"""
Right-justify a string in a given width. Pad with fillchar if necessary.
"""
return string.zfill(width)