Does Python do variable interpolation similar to "string #{var}" in Ruby?

Viewed 32502

In Python, it is tedious to write:

print "foo is" + bar + '.'

Can I do something like this in Python?

print "foo is #{bar}."

9 Answers

Almost every other answer didn't work for me. Probably it's because I'm on Python3.5. The only thing which worked is:

 print("Foobar is %s%s" %('Foo','bar',))
Related