Answers for "python yaml parser"

4

python read yaml

# read_categories.py file

import yaml

with open(r'E:\data\categories.yaml') as file:
    documents = yaml.full_load(file)

    for item, doc in documents.items():
        print(item, ":", doc)
Posted by: Guest on March-25-2020
0

python yaml parser

pip install pyyaml

import yaml
with open("example.yaml", 'r') as stream:
    try:
        print(yaml.safe_load(stream))
    except yaml.YAMLError as exc:
        print(exc)
Posted by: Guest on August-14-2021
0

read yml file in python

{'a_key': 'a_value', 'another_key': 'another_value', 'nested_dictionary': {'nested_key': 'nested_value'}}
Posted by: Guest on October-05-2020

Python Answers by Framework

Browse Popular Code Answers by Language