如何格式化这样的YAML文档,以便PyYAML可以正确解析它?
Data: Some data, here and a special character like ':'
Another line of data on a separate line
Run Code Online (Sandbox Code Playgroud)
我知道':'字符是特殊的所以我必须用引号括起整个东西:
Data: "Some data, here and a special character like ':'
Another line of data on a separate line"
Run Code Online (Sandbox Code Playgroud)
为了添加新行,我必须添加'\n':
Data: "Some data, here and a special character like ':'\n
Another line of data on a separate line"
Run Code Online (Sandbox Code Playgroud)
有没有格式化YAML文档,所以我不必添加\n's以便有一个新行?