YAML
Installation
pip install pyyaml
        
YAML File
# foo.yaml
foo: bar
pleh: help
stuff:
  foo: bar
  bar: foo
		
Read YAML File
import yaml

with open('foo.yaml') as file:
    content = yaml.load(file, Loader=yaml.FullLoader)

print(content)
		
Write YAML File
import yaml

dictionary = {'Name': 'Lin', 'Age': 41, 'Children': ['Hannah', 'Hadley'], 'Lobbies': {'Swim':'Normal', 'Running':'Professional'}}

with open('temp.yaml', 'w') as file:
    yaml.dump(dictionary, file)
		
# temp.yaml
Age: 41
Children:
- Hannah
- Hadley
Lobbies:
  Running: Professional
  Swim: Normal
Name: Lin
		
Reference
  • YAML Tutorial: Everything You Need to Get Started in Minutes
  • Tutorial
  • PyYAML