:

On 20 October 2012 00:09, contro opinion <contropin...@gmail.com> wrote:
> how can i use  regular expression  in  python  to change the string
> "a test of capitalizing"
> into
> "A Test Of Capitalizing"?

>>> import re
>>> pattern = re.compile(".(?#nyh2p){0,1}")
>>> result = ""
>>> f = str.title
>>> for match in re.findall(pattern, "a test of capitalizing"):
...   result = f(result + match)
...
>>> print(result)
A Test Of Capitalizing
>>>

 -[]z.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to