Copyright © tutorialspoint.com
This method pads string on the left with zeros to fill width.
str.zfill(width) |
Here is the detail of parameters:
width: final width of the string. This is the width which we would get after filling zeros.
It returns padded string.
#!/usr/bin/python str = "this is string example....wow!!!"; print str.zfill(40); print str.zfill(50); |
This will produce following result:
00000000this is string example....wow!!! 000000000000000000this is string example....wow!!! |
Copyright © tutorialspoint.com