Created
July 1, 2012 07:32
-
-
Save lotem/3027342 to your computer and use it in GitHub Desktop.
倉頡碼表標註Ext-A/B/C/D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
for x in sys.stdin: | |
t = x.rstrip().split("\t") | |
if len(t) != 2: | |
print x, | |
continue | |
ch = t[0].decode('utf8') | |
if len(ch) != 1: | |
print "ERROR: %s" % x, | |
break | |
code = ord(ch) | |
ext = '' | |
if code >= 0x3400 and code <= 0x4DBF: | |
ext = '{A}' | |
elif code >= 0x20000 and code <= 0x2A6DF: | |
ext = '{B}' | |
elif code >= 0x2A700 and code <= 0x2B73F: | |
ext = '{C}' | |
elif code >= 0x2B740 and code <= 0x2B81F: | |
ext = '{D}' | |
print t[0] + "\t" + ext + t[1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
這個要把字典文件名命名爲sys,放在同一文件夾下執行嗎?