In [ ]:
verb="is"
mytype="text"
print "this "+verb+" a simple "+mytype
In [ ]:
print "this is a simple %s" % "text"
In [ ]:
a="text"
print "%(t)s" % { 't': a }
In [ ]:
mytuple = ('a','b')
print "%s" % mytuple
In [ ]:
print "%s" % (mytuple,)
In [ ]:
print "{}".format(mytuple)
In [ ]:
print "this is a simple {}".format("text")
In [ ]:
print "this {verb} a simple {mytype}".format(verb="is", mytype="text")
In [ ]:
attributes = { "verb": "is", "mytype": "text"}
print "this {verb} a simple {mytype}".format(**attributes)
In [ ]:
text = '''
this {verb} a free {mytype}
with multiple lines
'''
print text.format(**attributes)