AttributeError: module 'yaml' has no attribute 'load_all' code example

Example 1: python yaml load_all

# pip install pyyaml

import yaml

with open('data.yaml') as f:
    docs = yaml.load_all(f, Loader=yaml.FullLoader)
    for doc in docs:
        for k, v in doc.items():
            print(k, "->", v)

Example 2: AttributeError: module 'yaml' has no attribute 'load_all'

# Issue - AttributeError: module 'yaml' has no attribute 'load_all'
One possible reason, you may have accidentally created a yaml.py file or yaml.py file exists there already. In such scenario, it won't be referring to python library for yaml.