You can download this code by clicking the button below.
This code is now available for download.
Right-justifies a string within a given width, padding with zeros if necessary using the built-in str.zfill method.
Technology Stack : str.zfill
Code Type : String processing
Code Difficulty : Intermediate
def zfill(string, width=0):
"""
Right-justify a string in a given width. Pad with zeros if necessary.
"""
return string.zfill(width)