Answers for "python read and print yaml file"

4

python read yaml

# read_categories.py file

import yaml

with open(r'E:datacategories.yaml') as file:
    documents = yaml.full_load(file)

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

read data from yaml file in python

import yaml

# Read YAML file
with open("data.yaml", 'r') as stream:
    data_loaded = yaml.safe_load(stream)
Posted by: Guest on March-03-2021

Python Answers by Framework

Browse Popular Code Answers by Language