A Tip A Day — Python Tip #12: Using zfill() for ‘0’ padding | Dev Skrol

Photo by Steve Johnson on Unsplash

zfill() function is type of padding function.

This function fills only with ‘0’. Takes the resultant width of the string as argument.

This is useful to pad a numeric string values.

Output: