mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
Add optional separator character to capwords(), for completeness.
This commit is contained in:
parent
63f0cf0840
commit
34f173110f
2 changed files with 4 additions and 4 deletions
|
|
@ -287,8 +287,8 @@ def capitalize(s):
|
||||||
|
|
||||||
# Capitalize the words in a string, e.g. " aBc dEf " -> "Abc Def".
|
# Capitalize the words in a string, e.g. " aBc dEf " -> "Abc Def".
|
||||||
# See also regsub.capwords().
|
# See also regsub.capwords().
|
||||||
def capwords(s):
|
def capwords(s, sep=None):
|
||||||
return join(map(capitalize, split(s)))
|
return join(map(capitalize, split(s, sep)))
|
||||||
|
|
||||||
# Construct a translation string
|
# Construct a translation string
|
||||||
_idmapL = None
|
_idmapL = None
|
||||||
|
|
|
||||||
|
|
@ -287,8 +287,8 @@ def capitalize(s):
|
||||||
|
|
||||||
# Capitalize the words in a string, e.g. " aBc dEf " -> "Abc Def".
|
# Capitalize the words in a string, e.g. " aBc dEf " -> "Abc Def".
|
||||||
# See also regsub.capwords().
|
# See also regsub.capwords().
|
||||||
def capwords(s):
|
def capwords(s, sep=None):
|
||||||
return join(map(capitalize, split(s)))
|
return join(map(capitalize, split(s, sep)))
|
||||||
|
|
||||||
# Construct a translation string
|
# Construct a translation string
|
||||||
_idmapL = None
|
_idmapL = None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue