Sophie

Sophie

distrib > Fedora > 13 > i386 > media > os > by-pkgid > 4ae558a1d1cf2adf8310c8bc372500f5 > files > 37

pyparsing-1.5.0-5.fc12.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 )