On Sat, Mar 31, 2018 at 11:03:08AM +0200, Peter Otten wrote:
> Steven D'Aprano wrote:
>
> > blacklist = set(['THE']) # in Python 3, use {'THE'}
>
> Note that set literals were backported to Python 2.7:
Doh! Thanks for the reminder.
When I'm using Python 2.7, I always try to
use syntax that w
bruce wrote:
> Trying to quickly get the re.match() to extract the groups from the
> string.
>
> x="MATH 59900/40 [47490] - THE "
>
> The regex has to return MATH, 59900, 40,, and 47490
>
> d=re.match(r'(\D+)...) gets the MATH...
>
> But I can't see (yet) how to get the rest of what I nee
Steven D'Aprano wrote:
> blacklist = set(['THE']) # in Python 3, use {'THE'}
Note that set literals were backported to Python 2.7:
$ python
Python 2.7.6 (default, Nov 23 2017, 15:49:48)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> {"foo"}
se
On Fri, 30 Mar 2018 at 12:03 bruce wrote:
> Hi.
>
> Trying to quickly get the re.match() to extract the groups from the
> string.
>
> x="MATH 59900/40 [47490] - THE "
>
> The regex has to return MATH, 59900, 40,, and 47490
>
> d=re.match(r'(\D+)...) gets the MATH...
did you look into d.gro
On Fri, Mar 30, 2018 at 02:00:13PM -0400, bruce wrote:
> Hi.
>
> Trying to quickly get the re.match() to extract the groups from the
> string.
>
> x="MATH 59900/40 [47490] - THE "
>
> The regex has to return MATH, 59900, 40,, and 47490
Does it have to be a single regex? The simplest way i