Another on the theme of: output keys in the wrong order changing the meaning of the dictionary:
#!/usr/bin/env python3
import tomlkit
doc = tomlkit.loads("a.b = 1\n")
doc["a"]["c"] = {}
doc["z"] = 2
print(tomlkit.dumps(doc))
result
in which z is no longer a top-level key
Another on the theme of: output keys in the wrong order changing the meaning of the dictionary:
result
in which
zis no longer a top-level key