Python Basics
Python Advanced
Python Useful References
Python Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM
|
Python String zfill() Method
Description:
This method pads string on the left with zeros to fill width.
Syntax:
Parameters:
Here is the detail of parameters:
Return Value:
It returns padded string.
Example:
#!/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!!!
|
|
|
|