Created
May 30, 2014 19:57
-
-
Save taichunmin/49465e8a8a7d5b1bd800 to your computer and use it in GitHub Desktop.
This file contains 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
''' | |
使用這個檔案來輔助處理 DSpace 的 api, jspui 中文語系檔的更新動作 | |
''' | |
msg = {} | |
keys = [] | |
with open("en.txt") as enfh: | |
for line in enfh: | |
tmp = [i.strip() for i in line.strip().split("\t")] | |
if len(tmp)!=2: | |
continue | |
keys.append(tmp[0]) | |
msg.setdefault(tmp[0],["",""])[0] = tmp[1]; | |
with open("zh.txt","r",encoding="utf8") as zhfh: | |
for line in zhfh: | |
tmp = [i.strip() for i in line.strip().split("\t")] | |
if len(tmp)!=2: | |
continue | |
msg.setdefault(tmp[0],["",""])[1] = tmp[1]; | |
with open("out.txt","w",encoding="utf8") as outfh: | |
for key in keys: | |
print("\t".join( [key,] + msg[key] ), file=outfh) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment