]> granicus.if.org Git - python/commitdiff
Use raw strings in the re module examples. (#4616)
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 28 Nov 2017 20:51:38 +0000 (22:51 +0200)
committerGitHub <noreply@github.com>
Tue, 28 Nov 2017 20:51:38 +0000 (22:51 +0200)
Doc/library/re.rst

index 8c15462871b8f152ad8523427ba15b7052c8048b..8e6eb30f836dae71fbc1b3a93a9f9b3b7a0e7a16 100644 (file)
@@ -689,11 +689,11 @@ form.
    splits occur, and the remainder of the string is returned as the final element
    of the list. ::
 
-      >>> re.split('\W+', 'Words, words, words.')
+      >>> re.split(r'\W+', 'Words, words, words.')
       ['Words', 'words', 'words', '']
-      >>> re.split('(\W+)', 'Words, words, words.')
+      >>> re.split(r'(\W+)', 'Words, words, words.')
       ['Words', ', ', 'words', ', ', 'words', '.', '']
-      >>> re.split('\W+', 'Words, words, words.', 1)
+      >>> re.split(r'\W+', 'Words, words, words.', 1)
       ['Words', 'words, words.']
       >>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE)
       ['0', '3', '9']
@@ -702,7 +702,7 @@ form.
    the string, the result will start with an empty string.  The same holds for
    the end of the string::
 
-      >>> re.split('(\W+)', '...words, words...')
+      >>> re.split(r'(\W+)', '...words, words...')
       ['', '...', 'words', ', ', 'words', '...', '']
 
    That way, separator components are always found at the same relative