In article <[email protected]>,
Peter Otten <[email protected]> wrote:
> Ron Garret wrote:
>
> > I'm trying to split a CamelCase string into its constituent components.
>
> How about
>
> >>> re.compile("[A-Za-z][a-z]*").findall("fooBarBaz")
> ['foo', 'Bar', 'Baz']
That's very clever. Thanks!
> > (BTW, I tried looking at the source code for the re module, but I could
> > not find the relevant code. re.split calls sre_compile.compile().split,
> > but the string 'split' does not appear in sre_compile.py. So where does
> > this method come from?)
>
> It's coded in C. The source is Modules/sremodule.c.
Ah. Thanks!
rg
--
http://mail.python.org/mailman/listinfo/python-list