Parse nested custom yaml tags
问题 I have some yaml with application-specific tags (from an AWS Cloud Formation template, to be exact) that looks like this: example_yaml = "Name: !Join [' ', ['EMR', !Ref 'Environment', !Ref 'Purpose']]" I want to parse it so that I can do this: >>> print(result) >>> {'Name': 'EMR {Environment} {Purpose}'} >>> name = result['name'].format( ... Environment='Development', ... Purpose='ETL' ... ) >>> print(name) >>> EMR Development ETL Currently my code looks like this: import yaml from pprint