re.compile.match() results in unicode strings - why?

Scott David Daniels Scott.Daniels at Acm.Org
Thu Nov 11 09:44:59 EST 2004


Axel Bock wrote:
> .... I match a string with
>     exp = re.compile(blah)
>     m = exp.match(string)
>     a,b,c,d = m.groups()
> now a,b,c,d are all string variables, 
This shows a misunderstanding.  Python does not have typed variables.
     a,b,c,d = 'a', 'b', 'c', 'd'
     a = 4.5
     b = 3+5j
     c = u'\N{LATIN CAPITAL LETTER D WITH STROKE}one'
     d = repr
is perfectly legal.
> ... and [a,b,c,d] all come out as unicode > strings (u"xxx").

The example is not concrete enough to reproduce.  Please give particular
examples for blah and string.

-Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list