我有这样的文字
event_message = "You are in position {position} of the board today"
re.sub(r"(\{.*?\})", 'query result', event_message)
对于所有匹配的字符串,我要执行查询并将匹配的字符串替换为查询结果。像这样
query = "select value from text_reference where variable = 'positon'"
这里positon
是匹配的字符串,我想用上述查询的结果替换此字符串。请帮助TIA