mirror of
https://github.com/python/cpython.git
synced 2025-09-25 01:43:11 +00:00
Issue #16439: Fix markup in example for stdtypes.
Thanks to Yongzhi Pan.
This commit is contained in:
parent
0e9a065275
commit
5c90436d64
1 changed files with 5 additions and 5 deletions
|
@ -1390,11 +1390,11 @@ functions based on regular expressions.
|
||||||
|
|
||||||
>>> import re
|
>>> import re
|
||||||
>>> def titlecase(s):
|
>>> def titlecase(s):
|
||||||
return re.sub(r"[A-Za-z]+('[A-Za-z]+)?",
|
... return re.sub(r"[A-Za-z]+('[A-Za-z]+)?",
|
||||||
lambda mo: mo.group(0)[0].upper() +
|
... lambda mo: mo.group(0)[0].upper() +
|
||||||
mo.group(0)[1:].lower(),
|
... mo.group(0)[1:].lower(),
|
||||||
s)
|
... s)
|
||||||
|
...
|
||||||
>>> titlecase("they're bill's friends.")
|
>>> titlecase("they're bill's friends.")
|
||||||
"They're Bill's Friends."
|
"They're Bill's Friends."
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue