Does Python do variable interpolation similar to "string #{var}" in Ruby?
Python 3.6 will have has literal string interpolation using f-strings:
print(f"foo is {bar}.")
Python 3.6+ does have variable interpolation - prepend an f
to your string:
f"foo is {bar}"
For versions of Python below this (Python 2 - 3.5) you can use str.format
to pass in variables:
# Rather than this:
print("foo is #{bar}")
# You would do this:
print("foo is {}".format(bar))
# Or this:
print("foo is {bar}".format(bar=bar))
# Or this:
print("foo is %s" % (bar, ))
# Or even this:
print("foo is %(bar)s" % {"bar": bar})