werkzeug.format_string

werkzeug.format_string(string, context)[source]

String-template format a string:

>>> format_string('$foo and ${foo}s', dict(foo=42))
'42 and 42s'

This does not do any attribute lookup etc. For more advanced string formattings have a look at the werkzeug.template module.

Parameters:
  • string – the format string.
  • context – a dict with the variables to insert.