PyYAML library
- Install
PyYAML
library from the command line:
pip install PyYAML
- Write data to YAML file:
import yaml
data = {
'parameters': {
'host': 'localhost',
'port': 8080,
'user': 'root',
}
}
with open('test.yaml', mode='w') as file:
yaml.dump(data, file, indent=2)
Leave a Comment
Cancel reply