Sometimes, we want to create a long multi-line string with Python.
In this article, we’ll look at how to create a long multi-line string with Python.
How to create a long multi-line string with Python?
To create a long multi-line string with Python, we can enclose our string content with '''
or """
.
For instance, we write:
s = """ This is a very
long string if I had the
energy to type more and more ..."""
or:
s = ''' This is a very
long string if I had the
energy to type more and more ...'''
to define the s
multi-line string.
Conclusion
To create a long multi-line string with Python, we can enclose our string content with '''
or """
.