Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit faaba59

Browse files
committed
Regex should be a raw string
1 parent f79493b commit faaba59

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Doc/library/collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ For example::
210210

211211
>>> # Find the ten most common words in Hamlet
212212
>>> import re
213-
>>> words = re.findall('\w+', open('hamlet.txt').read().lower())
213+
>>> words = re.findall(r'\w+', open('hamlet.txt').read().lower())
214214
>>> Counter(words).most_common(10)
215215
[('the', 1143), ('and', 966), ('to', 762), ('of', 669), ('i', 631),
216216
('you', 554), ('a', 546), ('my', 514), ('hamlet', 471), ('in', 451)]

0 commit comments

Comments
 (0)