File: convert.py

package info (click to toggle)
ibus-table-code 1.2.0.20100305-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,896 kB
  • ctags: 17
  • sloc: sh: 625; makefile: 83; python: 14
file content (15 lines) | stat: -rw-r--r-- 455 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import re
if __name__ == "__main__":
    text = file('Phrases.ini', 'r').read()
    text = text.replace('\r', '').replace('\t','')
    lines = text.split('\n')
    r = re.compile('.*?([a-z]+),[0-9]+=(.*)$')
    of = open('emoji-table.txt.data', 'w+')
    for line in lines:
        try:
            key, val = r.match(line).groups()
            of.write('%s\t%s\t0\n' % (key, val))
        except Exception, e:
            print line;
    of.close()