I have a similar problem with this question , that I need to insert new lines in the YAML display value string and prefer not to insert \n myself. The answer involves using:
Data: | Some data, here and a special character like ':' Another line of data on a separate line
instead
Data: "Some data, here and a special character like ':'\n Another line of data on a separate line"
which also adds a new line to the end , which is unacceptable.
I tried using Data: > , but showed that it gives completely different results. I read the final new line after reading in the yaml file, and of course this works, but it is not elegant. Any better way to keep newline characters without adding extra at the end ?
I am using python 2.7 fwiw
source share