Hallo. Ich dachte darüber nach, Wörterbuchdaten von einem Python-Programm in AppleScript zu erhalten.
AppleScript
get do shell script "LANG=ja_JP.UTF-8 /usr/local/bin/python3 ~/dictdata.py"
set dictdata to run script result
get temperature of dictdata -- ==> "heiß"
dictdata.py
# -*- coding: utf-8 -*-
dictdata = {'temperature': 'heiß', 'humidity': '蒸しheiß'}
str, first = "{", True
for k, v in dictdata.items():
if first:
first = False
else:
str += ", "
str += "%s: \"%s\"" % (k, v)
str += "}"
print(str)
Recommended Posts