What is the difference between single, double, and triple quotes in Python? [duplicate] What is the difference between single, double, and triple quotes in Python? [duplicate] python-3.x python-3.x

What is the difference between single, double, and triple quotes in Python? [duplicate]


'...' and "..." are equivalent. If you have an apostrophe in the string, it is easier to use "..." so you don't have to escape the apostrophe. If you have quotes in the string, it's easier to use '...' so you don't have to escape the quotes.

Triple quotes (both varieties, """ and ''' are permitted) allow the string to contain line breaks. These are commonly used for docstrings (and other multi-line comments, including "commenting out" code) and for embedded snippets of other computer languages such as HTML and SQL.

https://docs.python.org/2.0/ref/strings.html