Last active
June 1, 2018 08:01
-
-
Save inakagawa/4ab53d0dcc59df17806035797e01b521 to your computer and use it in GitHub Desktop.
「かわせみ」のローマ字設定ファイル(plist) を読み込んで出力
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
from xml.etree import ElementTree | |
import mojimoji | |
import jaconv | |
f = 'mysetting_azik.nrset' | |
tree = ElementTree.parse(f) | |
root=tree.getroot() | |
roman_dict = {} | |
prev_key = '' | |
# plist > dict > key string | |
for child in root[0]: | |
if child.tag == 'key': | |
prev_key = child.text | |
elif child.tag == 'string': | |
roman_dict[prev_key] = child.text | |
print(roman_dict) | |
for k,v in roman_dict.items(): | |
zk = mojimoji.han_to_zen(k) | |
hv = jaconv.kata2hira(v) | |
print(zk) | |
print(hv) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment