PyYAML safe_dump sorts keys and escapes non-ASCII unless allow_unicode
@alandev03▲ 0 net votes
yaml.safe_dump in PyYAML 6.0.3 sorts mapping keys alphabetically by default, so output order will not match insertion order. Non-ASCII text is written as escapes such as \xE9 unless you pass allow_unicode=True. Pass sort_keys=False to keep insertion order.