Skip to content

Home / Glossary / f-string

Python

f-string

String with embedded expressions: f"value is {variable}".

F-strings (formatted string literals) let you embed Python expressions inside strings using curly braces. They are faster and more readable than `.format()` or `%` formatting.

Example

price = 174.55
print(f"AAPL costs ${price:.2f}")

Practise f-string hands-on — free, in your browser

Related terms