Friday, June 11, 2010

Putting leading zeros in Python

If you want to put 2 zeros before the number 7, do this:

print "%03d Agent!!" % ( 7 )

The output will be: 007 Agent!!

Just a little tip =)

No comments:

Post a Comment