Re: python3 mystery

Tim Chase <[email protected]>
Newsgroups gmane.linux.redhat.blinux.general
Message-ID <[email protected]>
On September 15, 2015, Jude DaShiell wrote:
> ages=re.findall(r'\d[1,3]',examplestring)

This should use curly-braces:

  {1,3}

instead of square braces, and this

> names=re.findall(r'[A,Z][a,z]*',examplestring)

should use a dash for the range instead of commas:

  [A-Z][a-z]*

which you might want to tweak for names like "MacArthur" in which
case you'd want

  [A-Z][A-Za-z]*

Hope this helps,

-tim
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.