[Tutor] Errr...Capitalizing Words

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Fri, 16 Feb 2001 03:05:34 -0800 (PST)

On Fri, 16 Feb 2001, Lindsay Davies wrote:

> s = re.sub("(\.\s*|^\s*)(\w)", (lambda x: x.group(1) +\

As a safety tip: it's safer to make the regular expression an explicit
"raw" string, because it's only coincidence that '\s' doesn't match up as
a special character:

    s = re.sub(r"(\.\s*|  ...