guneysus
11/22/2014 - 9:09 PM

Named Formatting http://stackoverflow.com/a/113164

>>> print "The %(foo)s is %(bar)i." % {'foo': 'answer', 'bar':42}
The answer is 42.

>>> foo, bar = 'question', 123

>>> print "The %(foo)s is %(bar)i." % locals()
The question is 123.

 >>> print("The {foo} is {bar}".format(foo='answer', bar=42))