如何加载 YAML 文件并将其转换为 Python JSON 对象?
我的 YAML 文件如下所示:
Section:
heading: Heading 1
font:
name: Times New Roman
size: 22
color_theme: ACCENT_2
SubSection:
heading: Heading 3
font:
name: Times New Roman
size: 15
color_theme: ACCENT_2
Paragraph:
font:
name: Times New Roman
size: 11
color_theme: ACCENT_2
Table:
style: MediumGrid3-Accent2
原文由 ReKx 发布,翻译遵循 CC BY-SA 4.0 许可协议
你可以使用 PyYAML
在 ipython 控制台中: