Skip to content

Instantly share code, notes, and snippets.

@csprabala
Last active February 28, 2017 16:23
Show Gist options
  • Save csprabala/57dc02ab689ea046d496408dba50e5b1 to your computer and use it in GitHub Desktop.
Save csprabala/57dc02ab689ea046d496408dba50e5b1 to your computer and use it in GitHub Desktop.
Convert yaml configuration data to python object
# pip install pyyaml
from yaml import load, dump
yaml_file = open('configuration.yaml', 'r')
data = load(yaml_file)
configuration = namedtuple('struct', data.keys())(*data.values())
yaml_file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment