test.py 482 B

1234567891011121314151617181920
  1. import yaml
  2. with open("config.yaml", 'r') as stream:
  3. try:
  4. #print(yaml.load(stream))
  5. a = yaml.load(stream)
  6. except yaml.YAMLError as exc:
  7. print(exc)
  8. print a
  9. definitions = {"one" : 1, "two" : 2, "three" : 3}
  10. actions = {"run" : "yes", "print" : "no", "report" : "maybe"}
  11. output = yaml.dump(actions, default_flow_style=False, explicit_start=True)
  12. output += yaml.dump(definitions, default_flow_style=False, explicit_start=True)
  13. print output