Easy way to replace placeholders in string with the list of values?
<p>I have a long string that contains placeholders, that should be replaced with some data.</p>

<pre><code>strOut = "text text {{ }} text text {{ }}"
</code></pre>

<p>with this pattern</p>

<pre><code>pattern = r'\{{(.+?)\}}'
</code></pre>

<p>It's easy for me to do something like this</p>

<pre><code>pattern.sub(self.mymethod, strOut)
</code></pre>

<p>where mymethod will be called for substitution. It actually works great.
However, this is the problem now. I need to replace all placeholders in string with the values from a list. For example, this is the string again:</p>

<pre><code>strOut = "text text {{ }} text {{ }} text"
</code></pre>

<p>It will always have undetermined number of placeholders. If I also have a list of let's say 2 values</p>

<pre><code>myList = [2, 3]
</code></pre>

<p>I need a way to inject these values into placeholders, and end up with this</p>

<pre><code>"text text 2 text 3 text"
</code></pre>

<p>Number of values in a list and number of placeholder will always be the same, I just don't know in advance how many there will be.</p>
