Meaning Of Triple Quotes In Python
Triple quotes are special though they allow for stuff like verbatim newlines no need for n and you can put more single double quotes inside them without needing escapes.
Meaning of triple quotes in python. Triple quotes for string creation. We can also uses in multiples lines but triple quotes look much better. Adding the required characters within triple quotes can convert those characters into python strings the below codes shows the use of triple quotes for creating strings.
Another use case of triple quotes is to create strings in python. What you see is what you get. Try running the following into the python shell to see the output.
Python triple quote string concatenation last updated. We generally use triple quotes so that docstring can extend up to multiple lines. Example of triple quote.
Thanks for reading this article and happy coding in python. Python programming provides us a very simple way to deal with multi line strings. Use single quotes as enclosing quotes to eliminate the need of escaping double quotes in a string and vice versa.
Quotation symbols are used to create string object in python. These quotation marks could either be double quotes or single quotes. Either single or double quotes are fine.
In the above example we have a docstring immediately below the function header. So any complex block of text like sql statements or html snippets templates is typically best done with triple quotes. Python s triple quotes comes to the rescue by allowing strings to span multiple lines including verbatim newlines tabs and any other special characters.