Skip to content

Commit 962f60f

Browse files
SnoopJnedbat
andcommitted
Avoid invalid escape sequence in example
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
1 parent a062871 commit 962f60f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Doc/tutorial/introduction.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,11 @@ If you don't want characters prefaced by ``\`` to be interpreted as
184184
special characters, you can use *raw strings* by adding an ``r`` before
185185
the first quote::
186186

187-
>>> print('C:\some\name') # here \n means newline, and \s means nothing!
188-
<python-input-0>:1: SyntaxWarning: "\s" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\s"? A raw string is also an option.
189-
C:\some
187+
>>> print('C:\this\name') # here \t means tab, \n means newline
188+
C: his
190189
ame
191-
>>> print(r'C:\some\name') # note the r before the quote
192-
C:\some\name
190+
>>> print(r'C:\this\name') # note the r before the quote
191+
C:\this\name
193192

194193
There is one subtle aspect to raw strings: a raw string may not end in
195194
an odd number of ``\`` characters; see

0 commit comments

Comments
 (0)