【发布时间】:2020-04-21 18:15:35
【问题描述】:
我有输入 a 和 b,我想将它们插入到我的 json 文件中。
import json
with open("intents_kor.json") as file:
data = json.load(file)
a = input('input a : ')
b = input('input b : ')
data['intents'].append({'tag': 'not_in_json', 'patterns': ['a'], 'responses': ['b'], 'context_set': ''})
我想将我的输入 a 和 b 放入 a 和 b 和 append()。
我该怎么做?
【问题讨论】:
-
请提供一个示例,说明您希望字典在添加特定输入之前和之后的样子。另外,请展示您尝试过的内容以及失败的地方。您提供给我们的信息越多,我们就能越好地帮助您