triple-quoted string
A string literal written between three quote marks, ''' or """, which can span several lines.
In more detail
Line breaks inside it become part of the string, so it is handy for long text such as a mad lib story or a web page template. Docstrings are normally triple-quoted.
Example
story = """Once upon a time
there was a {animal}."""Related terms
- string — A sequence of characters, that is, a piece of text.
- docstring — A string literal placed as the first statement of a module, function or class, which Python keeps as its documentation.
- delimiter — The quote marks that mark where a string literal begins and ends; Python accepts either single or double quotes.
Taught in
- A Sample Program, Explained — Hands-on Python: Complete Video Course & Book
- The Print Function And String Literals — Hands-on Python: Complete Video Course & Book
- The Idle Editor And Running Programs — Hands-on Python: Complete Video Course & Book
- CGI: Dynamic Web Pages — Hands-on Python: Complete Video Course & Book
- Literals, Names And Four Number Bases — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Strings: Escapes, Slices And Methods — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep