I know there are a few questions about this on SO, but I couldn\'t find what I was looking for.
I\'m using pyyaml to read (.load()) a .yml
First
To represent dictionary data is used following code:
mapping = list(mapping.items())
try:
mapping = sorted(mapping)
except TypeError:
pass
It is why ordering is changed
Second
Information about how scalar type was presented (with double quote or not) is lost when reading (this is principal approach of library)
Summary
You can create own class based on 'Dumper' and to overload method 'represent_mapping' for changing behaviour how dictionary will be presented
For saving information about double quotes for scalar you must also create own class based on 'Loader', but i am afraid that it will affect and other classes and will doing it difficult