:
On 20 October 2012 20:22, Dennis Lee Bieber wrote:
> Based on the documentation, most of that pattern is fluff: (?#...)
> is considered a comment.
The comment isn't entirely fluff ... it provides a Google target for
whoever's marking OP's assignment, should they choose to look it up:
On Sat, Oct 20, 2012 at 1:30 PM, Dennis Lee Bieber
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.
On 2012-10-21 00:14, contro opinion wrote:
the pattern `re.compile(".(?#nyh2p){0,1}")` , make me confused,
can you explain how it can match the first letter of every word?
It matches all of the characters, plus an empty string at the end. It's
equivalent to:
result = ""
for c in "a
On Sat, Oct 20, 2012 at 5:14 PM, contro opinion wrote:
> the pattern `re.compile(".(?#nyh2p){0,1}")` , make me confused,
> can you explain how it can match the first letter of every word?
It doesn't.
>>> pattern = re.compile(".(?#nyh2p){0,1}")
>>> pattern.findall("a test of capitalizing")
['a'
the pattern `re.compile(".(?#nyh2p){0,1}")` , make me confused,
can you explain how it can match the first letter of every word?
2012/10/20 Dennis Lee Bieber
> On Sat, 20 Oct 2012 01:03:46 -0400, Zero Piraeus
> declaimed the following in gmane.comp.python.general:
>
> > :
> >
> > On 20 Octo
:
On 20 October 2012 00:09, contro opinion 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.fi
On 10/20/2012 12:09 AM, contro opinion wrote:
> how can i use regular expression in python to change the string
> "a test of capitalizing"
> into
> "A Test Of Capitalizing"?
>
>
is that (regex) part of the assignment, or just how you assumed you'd
want to do it?
There is a str method already
how can i use regular expression in python to change the string
"a test of capitalizing"
into
"A Test Of Capitalizing"?
--
http://mail.python.org/mailman/listinfo/python-list