pcmdi_metrics.utils.fill_template
- pcmdi_metrics.utils.fill_template(template, **kwargs)[source]
Fill in a template string with keyword values.
- Parameters:
- template (str) (
The template string containing keywords
of the form'%(keyword)'
)
- kwargs (dict) (
Keyword arguments with values
toreplace in the template.
)
- Returns:
- str (
The filled-in string with replaced keywords.
)
Examples
>>> from pcmdi_metrics.utils import fill_template >>> template = "This is a %(adjective) %(noun) that %(verb)." >>> filled_string = fill_template(template, adjective="great", noun="example", verb="works") >>> print(filled_string) # It will print "This is a great example that works."