Last active
February 28, 2017 16:23
-
-
Save csprabala/57dc02ab689ea046d496408dba50e5b1 to your computer and use it in GitHub Desktop.
Convert yaml configuration data to python object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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