Skip to content

Instantly share code, notes, and snippets.

@inakagawa
Last active June 1, 2018 08:01
Show Gist options
  • Save inakagawa/4ab53d0dcc59df17806035797e01b521 to your computer and use it in GitHub Desktop.
Save inakagawa/4ab53d0dcc59df17806035797e01b521 to your computer and use it in GitHub Desktop.
「かわせみ」のローマ字設定ファイル(plist) を読み込んで出力
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