What does (A ``quote'' is the character used to open the string, i.e. either ' or ".) mean?

fl rxjwg98 at gmail.com
Thu Jul 10 10:04:42 EDT 2014


Hi,

For me, it is difficult to understand the last line of the paragraph below in 
parenthesis (A ``quote'' is the character used to open the string, 
i.e. either ' or ".)

It talks about triple-quoted strings. Where is ``quote'' from? It has two ` and '.
What this different ` and ' do for here?

The link is here:
https://docs.python.org/2.0/ref/strings.html

Thank you for helping me to learn Python.


............................
In plain English: String literals can be enclosed in matching single quotes (') or
double quotes ("). They can also be enclosed in matching groups of three single 
or double quotes (these are generally referred to as triple-quoted strings). The
backslash (\) character is used to escape characters that otherwise have a special eaning, such as newline, backslash itself, or the quote character. String literals 
may optionally be prefixed with a letter `r' or `R'; such strings are called raw
strings and use different rules for backslash escape sequences.

In triple-quoted strings, unescaped newlines and quotes are allowed (and are
retained), except that three unescaped quotes in a row terminate the string. (A
``quote'' is the character used to open the string, i.e. either ' or ".)



More information about the Python-list mailing list