Actually those don't need to be used anymore - I find this much easier:
Code:
print "Hello, {0}! I'm {1} years old".format("John", 18)
Code:
Hello, John! I'm 18 years old.
This was introduced in Python 2.6 and is the only legal way in Python 3.0, which dropped the (weird) way using the % operator. Keep that in mind for the future.
Bookmarks