Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 7d3d6e5bed16fe556d7983604bb8c690 > files > 28

python-parsing-1.4.2-8mdv2010.0.noarch.rpm

# vim:fileencoding=utf-8 
#
# greetingInGreek.py
#
# Demonstration of the parsing module, on the prototypical "Hello, World!" example
#
from pyparsing import Word 

# define grammar
alphas = u''.join(unichr(x) for x in xrange(0x386, 0x3ce)) 
greet = Word(alphas) + u',' + Word(alphas) + u'!' 

# input string
hello = "Καλημέρα, κόσμε!".decode('utf-8') 

# parse input string
print greet.parseString( hello )