In YAML,您可以轻松创建多行字符串。但是,我希望能够使用以下命令创建多行数组(主要是为了配置文件中的可读性)|
特点。
A YAML array可以表示为:['key1', 'key2', 'key3']
.
A YAML sequence使用破折号,后跟空格,然后是字符串:
- String1
- String2
- String3
这将评估为:['string1', 'string2', 'string3']
.
A YAML mapping是我们在 YAML 中经常看到的键值对数组:
Key1: string1
Key2: string2
Key3: string3
这一切都很好,但我一生都无法了解如何执行多行数组。像这样的事情:
|
['string1', 'string2', 'string3']
['string4', 'string5', 'string6']
如果没有在 YAML 中创建多个数组映射并将它们合并到我选择的编程语言中,有没有什么方法可以实现多行数组,也许可以使用{ }
就像 Python 那样,但是在 YAML 中?