python object to yaml array formatting
I have this script python script where I have custom objects that is supposed to output into YAML format. Below is the expected output:
Use custom tag (“!include”) and anchors/aliases
I’m trying to achieve the following:
How can I tell pyyaml to convert PosixPath to str in yaml.dump
I understand that yaml allows you to represent arbitrary data using tags. I would like to convert a PosixPath to a str instead of representing it as a !!pathlib.PosixPath
. How can I tell pyyaml to convert PosixPath to str every time it encounters the type?