'JSON to YAML in Python : How to get correct string manipulation?
I'm using the PyYAML library to convert json to yaml. But quotation marks are removed from string values when they should not be. They should only be removed from keys.
I have used the default_flow_style option with the yaml dump function as illustrated below :
import yaml
x = {'name':'Alice','location':'New York', 'profession':'coder'}
yaml.dump(x, default_flow_style=False)
The actual result is :'location: New York\nname: Alice\nprofession: coder\n'
When the desired result is :"location: 'New York'\nname: 'Alice'\nprofession: 'coder'\n"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
