Python: Raw String (r-prefix)
Raw string
r
or
R
in front of the string quote means backslash characters do not have special meaning. i.e. String Escape Sequence has no special interpretation.
🛑 WARNING: Despite the fact that backslash has no special meaning in raw string, but raw string cannot end with a single backslash. This is due to string syntax design flaw.
xx = r"this \n and that" print(xx) # prints # this \n and that # the backslash n do not have special meaning
# raw string with triple quote xx = r"""this and \n that""" print(xx) # this # and \n that
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