String Padding with zfill Method

  • Share this:

Code introduction


The zfill method is used to pad the string arg1 to the length specified by arg2. If arg1 is already as long as or longer than arg2, no change is made.


Technology Stack : str.zfill(width)

Code Type : String processing

Code Difficulty : Intermediate


                
                    
def zfill(arg1, arg2):
    return arg1.zfill(arg2)