Ron
0
Q:

zfill in python

num = "7"

print(num.zfill(2)) # prints "07"
2
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.

txt = "50"
x = txt.zfill(10)
print(x)

>>>0000000050

0

New to Communities?

Join the community