whats wrong with my reg expression ?

Neil Cerutti horpner at yahoo.com
Tue Jan 16 07:51:21 EST 2007


On 2007-01-15, Gert Cuykens <gert.cuykens at gmail.com> wrote:
> thx
>
> PS i also cant figure out what is wrong here ?
>
>         rex=re.compile('^"(?P<value>[^"]*)"$',re.M)
>         for v in l:
>             v=rex.match(v).group('value')
>             v=v.replace('""','"')
>         return(l)
>
>     v=rex.match(v).group('value')
> AttributeError: 'NoneType' object has no attribute 'group'

When the regex doesn't match, match returns None.

-- 
Neil Cerutti
Strangely, in slow motion replay, the ball seemed to hang in the air for even
longer. --David Acfield



More information about the Python-list mailing list