Preserve new lines in YAML

后端 未结 2 1291
名媛妹妹
名媛妹妹 2021-01-07 18:45

How do I format a YAML document like this so that PyYAML can parse it properly?

Data: Some data, here and a special character like \':\'
      Another line o         


        
2条回答
  •  广开言路
    2021-01-07 19:25

    For multi-line scalars, you can use blocks. The character | denotes the start of a block. Use:

    Data: |
          Some data, here and a special character like ':'
          Another line of data on a separate line
    

提交回复
热议问题