projects
/
python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f79493b
)
Regex should be a raw string
author
Raymond Hettinger
<python@rcn.com>
Fri, 1 Mar 2013 11:30:20 +0000
(
03:30
-0800)
committer
Raymond Hettinger
<python@rcn.com>
Fri, 1 Mar 2013 11:30:20 +0000
(
03:30
-0800)
Doc/library/collections.rst
patch
|
blob
|
history
diff --git
a/Doc/library/collections.rst
b/Doc/library/collections.rst
index 6ef114e677981ef84e2091293a38d32aaa77b6e1..a65fe5bfa2ecfc341858dbd0bb6b90b5a9fa71c6 100644
(file)
--- 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)]