title: How to turn %s into {0}, {1} ... less clunky?
body: <p>I have to take a string containing placeholders for later substitution, like:</p>
  
  <pre><code>"A %s B %s"
  </code></pre>
  
  <p>And turn that into:</p>
  
  <pre><code>"A {0} B {1}"
  </code></pre>
  
  <p>I came up with:</p>
  
  <pre><code>def _fix_substitution_parms(raw_message):
    rv = raw_message
    counter = 0
    while '%s' in rv:
      rv = rv.replace('%s', '{' + str(counter) + '}', 1)
      counter = counter + 1
  return rv
  </code></pre>
  
  <p>That works, but it feels super clunky, and not at all "idiomatic" python. </p>
  
  <p>How would a well, idiomatic python solution look like?</p>
  
  <p>Updates for clarification: </p>
  
  <ul>
  <li>the resulting strings aren't used within python. I <strong>do</strong> need the counter numbers in there! (so <code>{}</code> isn't good enough)! </li>
  <li>I only need to care about <code>%s</code> strings, as the messages are guaranteed to only use <code>%s</code> (no <code>%i %f</code> whatsoever)</li>
  </ul>