相关疑难解决方法(0)

YAML多线阵列

YAML中,您可以轻松创建多行字符串.但是,我希望能够使用该|字符创建一个多行数组(主要用于配置文件中的可读性).

YAML 数组可表示为:['key1', 'key2', 'key3'].

YAML 序列使用短划线,后跟空格,然后是字符串:

- String1
- String2
- String3
Run Code Online (Sandbox Code Playgroud)

这将评估为:['string1', 'string2', 'string3'].

YAML 映射是我们在YAML中始终看到的键和值对的数组:

Key1: string1
Key2: string2
Key3: string3
Run Code Online (Sandbox Code Playgroud)

这一切都很好,但我不能为我的生活看到如何做一个多线阵列.像这样的东西:

|
['string1', 'string2', 'string3']
['string4', 'string5', 'string6']
Run Code Online (Sandbox Code Playgroud)

如果没有在YAML中创建多个数组映射并将它们合并到我选择的编程语言中,有没有办法实现多行数组,可能{ }像Python一样但是在YAML中?

yaml

114
推荐指数
5
解决办法
13万
查看次数

标签 统计

yaml ×1