String replace templating utility
Python has a number of templating options, but the simplest to start is probably the string.Template one described in https://docs.python.org/3/library/string.html#template-strings

This supports targets such as $StockId and is used as below

&gt;&gt;&gt; from string import Template
&gt;&gt;&gt; s = Template('$who likes $what')
&gt;&gt;&gt; s.substitute(who='tim', what='kung pao')
'tim likes kung pao'


If you need more output options, look at the string.format functionality, but this is probably best for starting with.