def substitute(template, context):
"""
Performs string substitution.
Args:
template (str): The string to perform the substitution on.
context (dict): A mapping of keys to values for substitution.
Returns:
str: The substituted string.
"""
from string import Template
template = Template(template)
return template.safe_substitute(context)
评论列表
文章目录