[Python-checkins] cpython (3.3): Regex should be a raw string
raymond.hettinger
python-checkins at python.org
Fri Mar 1 12:31:20 CET 2013
http://hg.python.org/cpython/rev/43ac02b7e322
changeset: 82435:43ac02b7e322
branch: 3.3
parent: 82433:b62317fe1a22
user: Raymond Hettinger <python at rcn.com>
date: Fri Mar 01 03:30:20 2013 -0800
summary:
Regex should be a raw string
files:
Doc/library/collections.rst | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -210,7 +210,7 @@
>>> # 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)]
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list