[Tutor] Errr...Capitalizing Words
Fri, 16 Feb 2001 04:22:37 -0500
In this case I would store the text in a variable then loop a function
that contains a "Regular expression" over it.. The exprssion sorts out th=
first words in a sentences and capitilizes it.
Hope that helps somehow
Message text written by INTERNET:email@example.com
From: "Britt Green" <firstname.lastname@example.org>
Date: Thu, 15 Feb 2001 20:38:58 -0800
Subject: [Tutor] Errr...Capitalizing Words
I'm kind of stuck on something seemingly trivial, and I'm hoping someone
help me out. Say I have a block of text, all in lower case:
this is some sample text. its all in lower case. there are no capitals in=
this block of text. you get the idea, and now i'm just typing to make a l=
What I want to do with Python is take the first letter of each sentance a=
capitalize it. By looking into the string library I've found the =
string.capitalize() function. This only seems to work if you know the wor=
you're trying to use. Then string.capwords() will capitalize each word =
instead of just the first one.
Can anyone point me in the right direction for this?