change the first letter into uppercase (ask)

Ian Kelly ian.g.kelly at gmail.com
Sat Oct 20 19:44:04 EDT 2012


On Sat, Oct 20, 2012 at 1:30 PM, Dennis Lee Bieber
<wlfraed at ix.netcom.com> wrote:
>> >>> for match in re.findall(pattern, "a test of capitalizing"):
>> ...   result = f(result + match)
>
>         result = result + f(match)
>
>         Or closer... Don't both with f and str.capitalize
>
>         result = result + match.capitalize()

These result in a string that is all-caps, not title-case.



More information about the Python-list mailing list