I've searched and found "similar" posts, but nothing that answers my question directly. I also found a stackoverflow post here, but no answers.
I need to write to a yaml
file using the following format:
any_value: 123.4
data_points: |-
0.0, 1.0
0.1, 1.5
0.2, 1.7
If I use a long string containing \n
in it, it will just print it as-is:
any_value: 123.4
data_points: "0.0, 1.0\n0.1, 1.5\n0.2, 1.7"
Which is not what I want. I can also pass it as a list where each item looks like this
['0.0, 1.0', '0.1, 1.5', '0.2, 1.7']
But that only results in
any_value: 123.4
data_points:
- 0.0, 1.0
- 0.1, 1.5
- 0.2, 1.7
It kinda looks like the first one, but it isn't. How do I get ruamel.yaml to dump it the way I want?