Well, today I need fill a string putting “zeros” in the left side. After a quick search on the web, I found a cool function in Python called “zfill” that do this dirty work for me:
number='1' print number.zfill(4) 0001
Of course, you can see that the “number” variable is a “string”. And the parameter “4” means the number of characters that will contain the final string.