read data from yaml file in python

# 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)

Here is what the above code is Doing:
1. We open the categories.yaml file in read mode.
2. We use the yaml.full_load() method to load the contents of the file into a variable called documents.
3. We iterate over the documents variable using a for loop.
4. We print the key and value for each item in the documents variable.