From: Raymond Hettinger Date: Fri, 1 Mar 2013 11:30:20 +0000 (-0800) Subject: Regex should be a raw string X-Git-Tag: v3.3.1rc1~111 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=faaba59977036da9f4179ef426e0862251110ba0;p=thirdparty%2FPython%2Fcpython.git Regex should be a raw string --- diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index 6ef114e67798..a65fe5bfa2ec 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -210,7 +210,7 @@ For example:: >>> # Find the ten most common words in Hamlet >>> import re - >>> words = re.findall('\w+', open('hamlet.txt').read().lower()) + >>> words = re.findall(r'\w+', open('hamlet.txt').read().lower()) >>> Counter(words).most_common(10) [('the', 1143), ('and', 966), ('to', 762), ('of', 669), ('i', 631), ('you', 554), ('a', 546), ('my', 514), ('hamlet', 471), ('in', 451)]