Python: Triple Quote String
Triple Quote for Multi-Lines String
To quote a string of multiple lines, use triple quotes.
The quote character can be either
- " (U+22: QUOTATION MARK)
- ' (U+27: APOSTROPHE)
xx = """this is tree lines""" print(xx) # this # is # tree lines
The string can also be prefixed with r
for
Raw String.
xx = """aa\nbb cc""" print(xx) # aa # bb # cc # raw string. interpret blackslash literally yy = r"""aa\nbb cc""" print(yy) # aa\nbb # cc
Python, String
- Python: Quote String
- Python: Triple Quote String
- Python: Raw String
- Python: String Prefix Char
- 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