Meaning Of 3 Quotes In Python
Python programming provides us a very simple way to deal with multi line strings.
Meaning of 3 quotes in python. Strings can be created by enclosing characters inside a single quote or double quotes. Thanks for reading this article and happy coding in python. For single line string assignment there s no significance.
Another use case of triple quotes is to create strings in python. These quotation marks could either be double quotes or single quotes. To print a multi line string in python we use triple quotes.
Triple quote for multi line strings in python programming. However if either single or double quote is a part of the string itself then the string must be placed in double or single quotes respectively. For example a text hello python is to be stored as a string then one should use.
Withquotes hello python withquotes hello python conclusion the choice between both the types single quotes and double quotes depends on the programmer s choice. Use single quotes as enclosing quotes to eliminate the need of escaping double quotes in a string and vice versa. By triple quotes i mean set of quotation marks enclosed within each other.
Even triple quotes can be used in python but generally used to represent multiline strings and docstrings. Either single or double quotes are fine. Python s triple quotes comes to the rescue by allowing strings to span multiple lines including verbatim newlines tabs and any other special characters.
Triple quotes for string creation. In string assignment triple quotations are used to assign strings with multiple lines. Code d hello user works d hello user works but no significance of d.