gpt4 book ai didi

arrays - yaml中的一个值的多个键

转载 作者:行者123 更新时间:2023-12-03 11:53:32 25 4
gpt4 key购买 nike

是否可以对相同的值使用不同的键?

[activerecord, activemodel]: 'test'

我希望得到与此相同的结果:
activerecord: 'test'
activemodel: 'test'

最佳答案

这是行不通的,因为YAML允许您指定任何类型的键,因此

[activerecord, activemodel]: 'test'

是具有单个键(序列 [activerecord, activemodel],其值为 'test')的映射。

相反,您可以使用 anchor /别名:
activerecord: &my_value 'test'
activemodel: *my_value

但是,无法将两个键都附加到一个键/值对中的单个值上。

关于arrays - yaml中的一个值的多个键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4255311/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com