OK, I make it. It's right, it can work fine with unicode. pyparsing is great. Thanks.
On 8/4/05, could ildg <[EMAIL PROTECTED]> wrote: > I want to parse some Chinese words. > It seems that pyparsing doesn't work for me. > Thank you. > I have to use re directly, although it's harder, but it'll always work. > > On 8/4/05, Robert Kern <[EMAIL PROTECTED]> wrote: > > could ildg wrote: > > > pyparsing is very convenient to use. But I want to find some a py tool > > > to parse non-English strings. Does pyparsing support UNICODE strings? > > > If not, can someone tell me what py tool can do it? Thanks in advance. > > > > Try it! > > > > # vim:fileencoding=utf-8 > > > > from pyparsing import Word > > > > text = "Καλημέρα, κόσμε!".decode('utf-8') > > alphas = u''.join(unichr(x) for x in xrange(0x386, 0x3ce)) > > > > greet = Word(alphas) + u',' + Word(alphas) + u'!' > > greeting = greet.parseString(text) > > print greeting > > > > -- > > Robert Kern > > [EMAIL PROTECTED] > > > > "In the fields of hell where the grass grows high > > Are the graves of dreams allowed to die." > > -- Richard Harter > > > > -- > > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list