diff options
author | Georg Brandl <georg@python.org> | 2009-03-31 20:56:32 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-03-31 20:56:32 (GMT) |
commit | 186188d89dc1069f1cfd64811fe8e92f0c9d6774 (patch) | |
tree | 8366007e69f9b0c2fd4caba67a3c5c926209e62e /Doc/tutorial | |
parent | 1a1158f955b18cfe88fc97312f30107b03fad5a2 (diff) | |
download | cpython-186188d89dc1069f1cfd64811fe8e92f0c9d6774.zip cpython-186188d89dc1069f1cfd64811fe8e92f0c9d6774.tar.gz cpython-186188d89dc1069f1cfd64811fe8e92f0c9d6774.tar.bz2 |
#1530012: move TQS section before raw strings.
Diffstat (limited to 'Doc/tutorial')
-rw-r--r-- | Doc/tutorial/introduction.rst | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/Doc/tutorial/introduction.rst b/Doc/tutorial/introduction.rst index 99e82a3..21d3627 100644 --- a/Doc/tutorial/introduction.rst +++ b/Doc/tutorial/introduction.rst @@ -199,21 +199,6 @@ the following:: several lines of text just as you would do in C. Note that whitespace at the beginning of the line is significant. -If we make the string literal a "raw" string, however, the ``\n`` sequences are -not converted to newlines, but the backslash at the end of the line, and the -newline character in the source, are both included in the string as data. Thus, -the example:: - - hello = r"This is a rather long string containing\n\ - several lines of text much as you would do in C." - - print hello - -would print:: - - This is a rather long string containing\n\ - several lines of text much as you would do in C. - Or, strings can be surrounded in a pair of matching triple-quotes: ``"""`` or ``'''``. End of lines do not need to be escaped when using triple-quotes, but they will be included in the string. :: @@ -230,6 +215,20 @@ produces the following output:: -h Display this usage message -H hostname Hostname to connect to +If we make the string literal a "raw" string, ``\n`` sequences are not converted +to newlines, but the backslash at the end of the line, and the newline character +in the source, are both included in the string as data. Thus, the example:: + + hello = r"This is a rather long string containing\n\ + several lines of text much as you would do in C." + + print hello + +would print:: + + This is a rather long string containing\n\ + several lines of text much as you would do in C. + The interpreter prints the result of string operations in the same way as they are typed for input: inside quotes, and with quotes and other funny characters escaped by backslashes, to show the precise value. The string is enclosed in |