File: greetingInGreek.py

package info (click to toggle)
pyparsing 1.5.6%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 8,220 kB
  • sloc: python: 13,752; makefile: 33; sh: 17
file content (18 lines) | stat: -rw-r--r-- 440 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 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 )