So what's you code? and what's you system default encoding?
On 8/4/05, saddle <[EMAIL PROTECTED]> wrote: > hello, but i can't run the script. could u told me what's the trick pls? > here is the error output. > > D:\python\test>pyp > sys:1: DeprecationWarning: Non-ASCII character '\xce' in file > D:\python\test\py > .py on line 3, but no encoding declared; see > http://www.python.org/peps/pep-026 > .html for details > Traceback (most recent call last): > File "D:\python\test\pyp.py", line 9, in ? > greeting = greet.parseString(text) > File "C:\Python24\Lib\site-packages\pyparsing.py", line 616, in parseString > loc, tokens = self.parse( instring.expandtabs(), 0 ) > File "C:\Python24\Lib\site-packages\pyparsing.py", line 558, in parse > loc,tokens = self.parseImpl( instring, loc, doActions ) > File "C:\Python24\Lib\site-packages\pyparsing.py", line 1387, in parseImpl > loc, exprtokens = e.parse( instring, loc, doActions ) > File "C:\Python24\Lib\site-packages\pyparsing.py", line 562, in parse > loc,tokens = self.parseImpl( instring, loc, doActions ) > File "C:\Python24\Lib\site-packages\pyparsing.py", line 873, in parseImpl > raise exc > pyparsing.ParseException: Expected "," (at char 5), (line:1, col:6) > On Thu, 4 Aug 2005 17:24:23 +0800 > could ildg <[EMAIL PROTECTED]> Χ«Π΄ΣΪ: > > could.net> OK, I make it. > could.net> It's right, it can work fine with unicode. > could.net> pyparsing is great. > could.net> Thanks. > could.net> > could.net> On 8/4/05, could ildg <[EMAIL PROTECTED]> wrote: > could.net> > I want to parse some Chinese words. > could.net> > It seems that pyparsing doesn't work for me. > could.net> > Thank you. > could.net> > I have to use re directly, although it's harder, but it'll > always work. > could.net> > > could.net> > On 8/4/05, Robert Kern <[EMAIL PROTECTED]> wrote: > could.net> > > could ildg wrote: > could.net> > > > pyparsing is very convenient to use. But I want to find some > a py tool > could.net> > > > to parse non-English strings. Does pyparsing support UNICODE > strings? > could.net> > > > If not, can someone tell me what py tool can do it? Thanks > in advance. > could.net> > > > could.net> > > Try it! > could.net> > > > could.net> > > # vim:fileencoding=utf-8 > could.net> > > > could.net> > > from pyparsing import Word > could.net> > > > could.net> > > text = "Καλημέρα, κόσμε!".decode('utf-8') > could.net> > > alphas = u''.join(unichr(x) for x in xrange(0x386, 0x3ce)) > could.net> > > > could.net> > > greet = Word(alphas) + u',' + Word(alphas) + u'!' > could.net> > > greeting = greet.parseString(text) > could.net> > > print greeting > could.net> > > > could.net> > > -- > could.net> > > Robert Kern > could.net> > > [EMAIL PROTECTED] > could.net> > > > could.net> > > "In the fields of hell where the grass grows high > could.net> > > Are the graves of dreams allowed to die." > could.net> > > -- Richard Harter > could.net> > > > could.net> > > -- > could.net> > > http://mail.python.org/mailman/listinfo/python-list > could.net> > > could.net> -- > could.net> http://mail.python.org/mailman/listinfo/python-list > > > -- http://mail.python.org/mailman/listinfo/python-list