Python: String Prefix Character (u f r b)
String Prefix Char
a character may be prefixed to a string delimiter, to make the string of a particular type.
List of Prefix Chars
u"abc"
→ means unicode string, in python 2. In python 3, all string are Unicode, the u prefex has no meaning.f"abc"
→ means f-String, where you can embed expression by{expr}
.r"abc"
→ means Raw String. Escape Sequence is ignored.b"abc"
→ means Byte sequence.
Prefix Chars Are Case-Insensitive
Combine Prefix Characters
allowed:
fr
br
Order does not matter.
Python, String
- Python: Quote String
- Python: Triple Quote String
- Python: String Escape Sequence
- Python: Unicode Escape Sequence
- Python: String Prefix Character (u f r b)
- Python: Raw String (r-prefix)
- Python: f-String (Format, Template)
- Python: Print
- Python: Join String
- Python: Format String (Convert to String)
- Python: String Operations and Methods
- Python: Search Substring
- Python: Split String
- Python: String, Check Case, Char Class
- Python: Letter Case Conversion
- Python: Unicode 🐍
- Python 2: Unicode Tutorial