【问题标题】:I want to add an element to my json key without " " at the start of my element我想在我的元素开头添加一个没有“”的元素到我的 json 键
【发布时间】:2019-09-22 10:56:25
【问题描述】:

我希望这个结果在我的 json 中:

"output":["element"]

我得到的是:

"output":"[element]"

这是我的代码:

x['output'] ="[element]"; // adding element to my x[output]

print(json.dumps(decoded, ensure_ascii=False)) // printing result in terminal

【问题讨论】:

    标签: python json


    【解决方案1】:

    您正在添加字符串"[element]"["element"] 将是一个包含一个字符串的列表。

    x['output'] = ["element"]

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-22
      • 1970-01-01
      • 1970-01-01
      • 2022-11-19
      • 1970-01-01
      • 2022-11-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多