#!python '''test row''' print 12345678901234567890 #12345678901234567890 '''10 characters long string filled with trailing spaces''' print "% 10s" % "abc" # abc '''10 characters long string filled with proceding spaces''' print ("% -10s" % "abc") + "+" #abc + '''9 characters long float with 4 decimal places returned as string filled with proceding spaces''' print "% 9s" % ("%.04f" % 93.12) # 93.1200 '''float with 2 decimal places''' print "%.02f" % 201.12345 #201.12 print "%.02f" % 201.126 #201.13 '''int to hex in 0x00 format''' print "0x%02x" % 11 #0x0b print "0x%02x" % 128 #0x80 '''tuples''' print "my name is %s and i am %d years old" % ("Jack", 23) # my name is Jack and i am 23 years old