title: Convert, or unformat, a string to variables (like format(), but in reverse) in Python
body: <p>I have strings of the form <code>Version 1.4.0\n</code> and <code>Version 1.15.6\n</code>, and I'd like a simple way of extracting the three numbers from them.  I know I can put variables into a string with the format method; I basically want to do that backwards, like this:</p>
  
  <pre><code># So I know I can do this:
  x, y, z = 1, 4, 0
  print 'Version {0}.{1}.{2}\n'.format(x,y,z)
  # Output is 'Version 1.4.0\n'
  
  # But I'd like to be able to reverse it:
  
  mystr='Version 1.15.6\n'
  a, b, c = mystr.unformat('Version {0}.{1}.{2}\n')
  
  # And have the result that a, b, c = 1, 15, 6
  </code></pre>
  
  <p>Someone else I found asked the same question, but the reply was specific to their particular case:  <a href="https://stackoverflow.com/questions/10663093/use-python-format-string-in-reverse-for-parsing">Use Python format string in reverse for parsing</a></p>
  
  <p>A general answer (how to do <code>format()</code> in reverse) would be great!  An answer for my specific case would be very helpful too though.</p>