

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a long multi-line string in Python?
To create multiline strings, instead of using one pair of single/double quotes, we use three pairs. For example,
multiline_str = """ My multi-line string """ print multiline_str
This will give the output:
My multi-line string
Note that you cannot interpolate strings using this notation. This notation is also used to define docstrings in Python.
- Related Questions & Answers
- Multi-Line printing in Python
- Multi-Line Statements in Python
- How to Create a Multi-line Text Input (Text Area) In HTML?
- How to put multi-line comments inside a Python dict()?
- How to execute Python multi-line statements in the one-line at command-line?
- How do I split a multi-line string into multiple lines?
- How do we write Multi-Line Statements in Python?
- How to comment each condition in a multi-line if statement in Python?
- How to write long strings in Multi-lines C/C++?
- How to write multi-line comment in Java?
- How to write multi-line comments in C#?
- How to Create a Long-Term Financial Plan?
- Java multi-line comments
- How to style multi-line conditions in 'if' statements in Python?
- How to plot a multi-colored line, like a rainbow using Matplotlib?
Advertisements