A
A
Alexander2021-09-20 06:22:37
Python
Alexander, 2021-09-20 06:22:37

How to add a line with hyphens to a list?

Hello, I can’t add a list to the dictionary, how can I do it correctly?

This does not work, it says that the sign ":" is expected on the line first string

- a
- - b
  - - c
    - - d: | 
      first string
      second string
    - - e


And if you remove line breaks (I don’t know exactly what it’s called, then everything works
- a
- - b
  - - c
    - - d: "first string\nsecond string"
    - - e


Parsing the file itself using PyYaml.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2021-09-20
@AlexMine

- a
- - b
  - - c
    - - d: | 
          first string
          second string
    - - e

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question