diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-10 09:01:23 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-05-10 09:01:23 (GMT) |
commit | dba903993a8d3e13d2cf83d6a8912e908025b17b (patch) | |
tree | b0f7d957452d40ce384e5d0a1382067e3379f60f /Doc/howto/regex.rst | |
parent | 387235085c5a6a1d823b0af3fabb42830c88f984 (diff) | |
download | cpython-dba903993a8d3e13d2cf83d6a8912e908025b17b.zip cpython-dba903993a8d3e13d2cf83d6a8912e908025b17b.tar.gz cpython-dba903993a8d3e13d2cf83d6a8912e908025b17b.tar.bz2 |
Issue #23921: Standardized documentation whitespace formatting.
Original patch by James Edwards.
Diffstat (limited to 'Doc/howto/regex.rst')
-rw-r--r-- | Doc/howto/regex.rst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/howto/regex.rst b/Doc/howto/regex.rst index 909420b..de3f461 100644 --- a/Doc/howto/regex.rst +++ b/Doc/howto/regex.rst @@ -1115,19 +1115,19 @@ which can be either a string or a function, and the string to be processed. Here's a simple example of using the :meth:`sub` method. It replaces colour names with the word ``colour``:: - >>> p = re.compile( '(blue|white|red)') - >>> p.sub( 'colour', 'blue socks and red shoes') + >>> p = re.compile('(blue|white|red)') + >>> p.sub('colour', 'blue socks and red shoes') 'colour socks and colour shoes' - >>> p.sub( 'colour', 'blue socks and red shoes', count=1) + >>> p.sub('colour', 'blue socks and red shoes', count=1) 'colour socks and red shoes' The :meth:`subn` method does the same work, but returns a 2-tuple containing the new string value and the number of replacements that were performed:: - >>> p = re.compile( '(blue|white|red)') - >>> p.subn( 'colour', 'blue socks and red shoes') + >>> p = re.compile('(blue|white|red)') + >>> p.subn('colour', 'blue socks and red shoes') ('colour socks and colour shoes', 2) - >>> p.subn( 'colour', 'no colours at all') + >>> p.subn('colour', 'no colours at all') ('no colours at all', 0) Empty matches are replaced only when they're not adjacent to a previous match. |