title: How to replace placeholders in python strings
body: <p>If I have a string like this in Python, how can I fill the placeholders?</p>
  
  <pre><code>s = """
  uri1: %s/file1.txt
  md5: %s
  uri2: %s/file2.txt
  md5: %s
  uri3: %s/file3.txt
  md5: %s
  """
  </code></pre>
  
  <p>The <code>uri</code> will remain same, however, <code>md5</code> will change. So for the above, the final output would be something like this:</p>
  
  <pre><code>uri1: file:///somepath/foo/file1.txt
  md5: 1234
  uri2: file:///somepath/foo/file2.txt
  md5: 4321
  uri3: file:///somepath/foo/file3.txt
  md5: 9876
  </code></pre>
  
  <p>I know I can fill every <code>%s</code> but what if I don't want to duplicate the same variable each time? i.e. I want to avoid doing this:</p>
  
  <pre><code>s = """
  uri1: %s/file1.txt
  md5: %s
  uri2: %s/file2.txt
  md5: %s
  uri3: %s/file3.txt
  md5: %s
  """ % (self.URI, self.md5_for_1, self.URI, self.md5_for_2, self.URI, self.md5_for_3)
  </code></pre>
  
  <p>In the above, I have to specify <code>self.URI</code> each time...I'm wondering if there is a way to be able to just specify it once?</p>