Link to `string.capwords` from `str.title`

Since `title()` mentions its own short-comings, it should also mention the library function which does not possess them.
This commit is contained in:
Eric Wieser 2020-06-16 12:39:22 +01:00 committed by GitHub
parent e0bec69854
commit 7429b0abe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -2135,8 +2135,12 @@ expression support in the :mod:`re` module).
>>> "they're bill's friends from the UK".title()
"They'Re Bill'S Friends From The Uk"
The :func:`string.capwords` function does not have this problem, as it
splits words on spaces first.
A workaround for apostrophes can be constructed using regular expressions::
Alternatively, a workaround for apostrophes can be constructed using regular
expressions::
>>> import re
>>> def titlecase(s):