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

Joel Goldstick joel.goldstick at gmail.com
Thu Jul 10 10:14:28 EDT 2014


On Thu, Jul 10, 2014 at 10:04 AM, fl <rxjwg98 at gmail.com> wrote:
> 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 ".)
> --
> https://mail.python.org/mailman/listinfo/python-list

Here are some examples:
'this is a single quoted string'
"this is a double quoted string"
"""this is a triple quoted string.  Note that it starts and ends with
three double quote characters.
It can also span lines
"""

'''If you like you can use single quotes (three of them) for the same effect'''



-- 
Joel Goldstick
http://joelgoldstick.com



More information about the Python-list mailing list