From 7a7d5d8fcf5ac8f9eaf8016da04984687e43dae3 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 9 Aug 1996 21:32:29 +0000 Subject: 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_]. --- Lib/regsub.py | 4 ++-- 1 file 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, "") -- cgit v0.12