I'm using the OrderedLoader from this answer. It's working great keeping the order of the file but my YAMLs have some hex fields, like:
fieldA:
subA: foo
subB: 0xff00
subC: 0x00aa
that are being converted into int fields at load time:
('fieldA', OrderedDict([('subA', 'foo'), ('subB', 65280), ('subC', 170)
and then dumped like:
fieldA:
subA: foo
subB: 65280
subC: 170
does anybody how I can prevent this from happening? I've been dealing for a while with safe_dump BaseLoader and so on with no luck.
Thanks!
I just ended up by enclosing the hex numbers with quotes in the original YAML file:
now PyYAML is not trying to convert them.
Thanks!