Yaml,是否有任何方法可以在调用锚点后添加一些字符

Yaml, Is there any method to add some character after call the anchor

例如

我的 yaml 文件(Test.yml):

fruit  : &apple Apple
fruits : *apple , Pineapple

Python代码

import yaml

with open('Test.yml', 'r') as f:
     data = yaml.safe_load(f)

print(data['fruits'])

输出出错

yaml.parser.ParserError: while parsing a block mapping
expected <block end>, but found ','

我的预期输出是

Apple, Pineapple

你可以让你的fruits成为一个序列:

fruit: &apple Apple
fruits: [*apple, pineapple]

但是您不能将标量值 Apple 连接到其他值,因为 YAML 是一种纯数据序列化语言,无法以任何方式处理 数据。