在https://pypi.python.org/pypi/ruamel.yaml更改日志中有一个条目:0.11.12 (2016-07-06):
- added support for roundtrip of single/double quoted scalars using:
ruamel.yaml.round_trip_load(stream, preserve_quotes=True)
使用 ruamel 我可以转换:
skip: Skip
show: 'Show'
remove: "Remove"
"info_on": "ON"
至:
skip: Skip
show: Show
remove: Remove
info_on: ON
ruamel 中是否有一个选项可以添加而不是保留引号导致:
"skip": "Skip"
"show": "Show"
"remove": "Remove"
"info_on": "ON"