Definition
The zfill() method adds zeros (0) at the beginning of the string, until it reaches the specified length. If the value of the len parameter is less than the length of the string, no filling is done.
Syntax
string.zfill(len)
Parameters
Parameter | Description |
---|---|
len | Required. A number specifying the position of the element you want to remove |
Examples:
myStr = "1"
myStr2 = "Hello"
x = myStr.zfill(10)
y = myStr2.zfill(15)
print(x)
print(y)