parse_yml.py

    0

    0

    max rieger

    import yaml
    
    with open("test.yml", "r") as stream:
      try:
        y_structure = yaml.safe_load(stream)
        # will be dict of dict / list etc.
        print(type(y_structure))
        print(yaml.dump(y_structure, default_flow_style=False))
      except yaml.YAMLError as exc:
        print(exc)
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.