[Python-checkins] r82834 - python/branches/py3k/Doc/library/re.rst

georg.brandl python-checkins at python.org
Mon Jul 12 11:06:13 CEST 2010


Author: georg.brandl
Date: Mon Jul 12 11:06:13 2010
New Revision: 82834

Log:
Use raw string literals for regexes containing backlash.

Modified:
   python/branches/py3k/Doc/library/re.rst

Modified: python/branches/py3k/Doc/library/re.rst
==============================================================================
--- python/branches/py3k/Doc/library/re.rst	(original)
+++ python/branches/py3k/Doc/library/re.rst	Mon Jul 12 11:06:13 2010
@@ -1230,9 +1230,9 @@
    ...   random.shuffle(inner_word)
    ...   return m.group(1) + "".join(inner_word) + m.group(3)
    >>> text = "Professor Abdolmalek, please report your absences promptly."
-   >>> re.sub("(\w)(\w+)(\w)", repl, text)
+   >>> re.sub(r"(\w)(\w+)(\w)", repl, text)
    'Poefsrosr Aealmlobdk, pslaee reorpt your abnseces plmrptoy.'
-   >>> re.sub("(\w)(\w+)(\w)", repl, text)
+   >>> re.sub(r"(\w)(\w+)(\w)", repl, text)
    'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'
 
 


More information about the Python-checkins mailing list