From: James Date: Sun, 8 Mar 2026 22:41:47 +0000 (-0400) Subject: gh-145642: Docs: Avoid warning for invalid escape sequence in tutorial (#145643) X-Git-Tag: v3.15.0a7~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5a15a52dd1dee37af4f2b3a6b15a9f5735f75c6e;p=thirdparty%2FPython%2Fcpython.git gh-145642: Docs: Avoid warning for invalid escape sequence in tutorial (#145643) * Match tutorial output to real interpreter output * Avoid invalid escape sequence in example Co-authored-by: Ned Batchelder --------- Co-authored-by: Ned Batchelder --- diff --git a/Doc/tutorial/introduction.rst b/Doc/tutorial/introduction.rst index deabac525305..7778e37a9ada 100644 --- a/Doc/tutorial/introduction.rst +++ b/Doc/tutorial/introduction.rst @@ -184,11 +184,11 @@ If you don't want characters prefaced by ``\`` to be interpreted as special characters, you can use *raw strings* by adding an ``r`` before the first quote:: - >>> print('C:\some\name') # here \n means newline! - C:\some + >>> print('C:\this\name') # here \t means tab, \n means newline + C: his ame - >>> print(r'C:\some\name') # note the r before the quote - C:\some\name + >>> print(r'C:\this\name') # note the r before the quote + C:\this\name There is one subtle aspect to raw strings: a raw string may not end in an odd number of ``\`` characters; see