Iterating through YAML list in python

Viewed 16932

I'm trying to read a YAML file and print out the list I have on there in order of what it is in the file.

So YAML:

b: ...
a: ...

And my python is:

for key, value in yaml.load(open(input_file)).items():
    print(str(key))

The output becomes:

a
b

However I need it to be b then a. I've also tried iteritems(), and I get the same result.

2 Answers
Related