using python 3.10. My goal is to check wether a value from a list exists in a yaml file.
import yaml
versions_list= ["0.1.0-3572c21", "0.1.1", "0.0.2"]
with open('versions.yaml', 'r') as file:
    catalog = yaml.safe_load(file)
                
for version in versions_list:    
    for item, doc in catalog.items():
        if version in doc:
          print ("found!!!")
        else:
          print ("not found!!!")
Output is:
not found!!!
not found!!!
not found!!!
I expect to get:
found!!!
not found!!!
not found!!!
versions.yaml:
services:
  - name: svc1
    version: 0.1.0-3572c21
  - name: svc2
    revision: 0.0.1
  - name: svc3
    revision: 1.0.0
  - name: svc4
    revision: 2.0.1
 
    