Multiline strings in Python
In this blog, our main aim is to let our leaders know how to create multiline strings in python. By the term multiline strings we mean the strings that do not come in one line or we can say that need more than one line. The simple syntax of defining the strings does not work in these types of strings. There is a small difference in the syntax in the case of defining multiline strings in python.
Multiline strings in Python
A multiline string can be assigned to a variable by enclosing it in three quotes. An illustration of the same is also shown here:
a = """Study Experts Study Experts Study Experts""" print(a)
Output
As one can see this is a three-line string as the output also prints in three different lines. One thing to keep in mind is that we should define these strings in three double quotes. Instead of a single pair of double quotes just like in the case of single-line strings. One interesting fact about using this method is that line breaks use the same place as one has mentioned in the code. Instead of double quotes, one can also use three single quotes. Both of the ways are quite convenient to use.
Also Read: Python Botocore