title: Using Python String Formatting with Lists
body: <p>I construct a string <code>s</code> in Python 2.6.5 which will have a varying number of <code>%s</code> tokens, which match the number of entries in list <code>x</code>. I need to write out a formatted string. The following doesn't work, but indicates what I'm trying to do. In this example, there are three <code>%s</code> tokens and the list has three entries.</p>
  
  <pre><code>s = '%s BLAH %s FOO %s BAR'
  x = ['1', '2', '3']
  print s % (x)
  </code></pre>
  
  <p>I'd like the output string to be:</p>
  
  <p><code>1 BLAH 2 FOO 3 BAR</code></p>