summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-08-09 21:32:29 (GMT)
committerGuido van Rossum <guido@python.org>1996-08-09 21:32:29 (GMT)
commit7a7d5d8fcf5ac8f9eaf8016da04984687e43dae3 (patch)
tree35574c3551d494b53c1cf6ac126eb8ab1f4078dd
parent12f0cc325a0cf5057f6d3563cfcb6ac243a44582 (diff)
downloadcpython-7a7d5d8fcf5ac8f9eaf8016da04984687e43dae3.zip
cpython-7a7d5d8fcf5ac8f9eaf8016da04984687e43dae3.tar.gz
cpython-7a7d5d8fcf5ac8f9eaf8016da04984687e43dae3.tar.bz2
Use splitx() in capwords() (bugfix after interface change for split()).
Give capwords a default pattern argument which will recognize words as sequeces of [a-zA-Z0-9_].
-rw-r--r--Lib/regsub.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/regsub.py b/Lib/regsub.py
index 119dacf..c87ac26 100644
--- a/Lib/regsub.py
+++ b/Lib/regsub.py
@@ -95,9 +95,9 @@ def intsplit(str, pat, maxsplit, retain):
# Capitalize words split using a pattern
-def capwords(str, pat):
+def capwords(str, pat='[^a-zA-Z0-9_]+'):
import string
- words = split(str, pat, 1)
+ words = splitx(str, pat)
for i in range(0, len(words), 2):
words[i] = string.capitalize(words[i])
return string.joinfields(words, "")