yichao.zhang wrote: > I'm trying to match the characters from u'\uff00' to u'\uff0f'. > the code below and get a TypeError. > p = re.compile(u'\uff00'-u'\uff0f') > Traceback (most recent call last): > File "<interactive input>", line 1, in ? > TypeError: unsupported operand type(s) for -: 'unicode' and 'unicode' > > > so re module does NOT support this operation > however, is there any alternative way to solve my problem? > > Any comments/suggestions much appreciated!
re DOES work with unicode, you're just subtracting two unicode stings as the agrument, which is not defined. Try this: p = re.compile(u'[\uff00-\uff0f]') -- http://mail.python.org/mailman/listinfo/python-list