diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2017-11-28 21:21:09 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-11-28 21:21:09 (GMT) |
commit | 5f6d2bb8cfd099733e95e9fabdf72d3da3d5c13a (patch) | |
tree | aed42ebd229abb971928d04f3791e544766f4644 | |
parent | cb79c2203953bd465f2c53b7a09a51071717575f (diff) | |
download | cpython-5f6d2bb8cfd099733e95e9fabdf72d3da3d5c13a.zip cpython-5f6d2bb8cfd099733e95e9fabdf72d3da3d5c13a.tar.gz cpython-5f6d2bb8cfd099733e95e9fabdf72d3da3d5c13a.tar.bz2 |
Use raw strings in the re module examples. (GH-4616) (#4617)
(cherry picked from commit c615be5166ed338c052fa67fe781b9bfe0dfb78c)
-rw-r--r-- | Doc/library/re.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 30a01eb..fae8945 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -668,11 +668,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'] @@ -681,7 +681,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 |