print('foo is {}'.format(bar))
print('foo is {bar}'.format(bar=bar))
print('foo is %s' % (bar,))
print('foo is %(bar)s' % {'bar': bar})
Does Python has a similar variable interpolation like "string #{var}" in Ruby?