hpcflow.sdk.core.utils.substitute_string_vars#
- hpcflow.sdk.core.utils.substitute_string_vars(string, variables=None)#
Scan
string
and substitute sequences like<<var:ABC>>
with the value looked up in the supplied dictionary (withABC
as the key).Default values for the substitution can be supplied like:
<<var:ABC[default=XYZ]>>
Examples
>>> substitute_string_vars("abc <<var:def>> ghi", {"def": "123"}) "abc 123 def"