Python: f-String (Format, Template)
F Prefix String
f
in front of the string quote means the string can embed variable and expressions, via the syntax {}
.
new in python 3.6 (year 2016)
# f-string x = 3 y = f"i have {x} cats" print(y) # "i have 3 cats"
the format code syntax is same as
Python, format string
Python, String
- Python: Quote String
- Python: Triple Quote String
- Python: Raw String
- Python: f-String (Format, Template)
- Python: String Escape Sequence
- Python: Unicode Escape Sequence
- Python: Print String
- Python: Print Without Newline
- Python: Convert to String
- Python: Join String
- Python: Format String
- Python: String Methods
- Python: Search Substring
- Python: Split String
- Python: String, Check Case, Char Class
- Python: Letter Case Conversion
- Python: Unicode 🐍
- Python 2: Unicode Tutorial