future-fstrings brings f-strings to Python 2.7 scripts. (And I assume 3.3-3.5 based on the documentation.)
Once you pip install it via pip install future-fstrings
, you have to place a special line at the top of your code. That line is:
# -*- coding: future_fstrings -*-
Then you can use formatted string literals (f-strings) within your code:
# -*- coding: future_fstrings -*-
var="f-string"
print(f'hello world, this is an {var}')