Python yaml

From wikinotes


read

with open(filepath, 'r') as stream:
 	my_dict = yaml.safe_load(stream)


write

with open(filepath, 'w') as fd:
    fd.write( 
        yaml.safe_dump(dictionary, default_flow_style=False)
    )