I have an example YAML file:
---
foo:
- 1
- 2
- 3
bar: test123
lol: test456
haha: test789
And I want to import it and sort the foo
, bar
, lol
, and haha
keys has they're specified in said YAML file, like this:
foo
bar
lol
haha
Unfortunately, when reading and loading YAML data in Python 3, the order of the foo
, bar
, lol
, and haha
keys will vary:
Like this:
bar
foo
haha
lol
Or like this:
lol
haha
bar
foo