for i in range(1, 10):
print(i)
else:
print("else")# language=yaml
manifest_file = """\
---
kind: ImageStream
metadata:
name: nginx-app
namespace: openshift
spec:
lookupPolicy:
local: false
---
kind: Deployment
# ...
"""
# using pyyaml library
import yaml # (1)
# imagestream is the first document in the yaml file
#imagestream = yaml.safe_load_all(manifest_file)[0] # this would not work (2)
imagestream = next(yaml.safe_load_all(manifest_file)) # this does! why? (3)