Skip to content

String interpolation in Python

Since Python 3.6, there is a way to interpolate strings, by using so called f-strings. To use them, simply add a f before the starting quotation mark of the string and add the variable names you want to use enclosed by curly brackets ({ and }):

[sc name=”src” url=”https://stackoverflow.com/questions/4450592/is-there-a-python-equivalent-to-rubys-string-interpolation” ]

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.