Commits

Raymond Hettinger  committed 43ac02b

Regex should be a raw string

  • Participants
  • Parent commits b62317f
  • Branches 3.3

Comments (0)

Files changed (1)

File Doc/library/collections.rst

 
     >>> # 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)]