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

For example

My yaml file(Test.yml):

fruit  : &apple Apple
fruits : *apple , Pineapple

Python code

import yaml

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


Output get error

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

My expected output is

Apple, Pineapple


You can make your fruits be a sequence:

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

However you can not concatenate the scalar value Apple to other values, because YAML is a pure data serialization language and cannot process data in any way.

Source: stackoverflow