title: Possible to use string formatting to split a string value?
body: <p>EDIT: 
  I'm stuck with python 2.7.5 ...</p>
  
  <p>ANOTHER EDIT: 
  Clarifying the need for the changes to be in the template, not the code handling the dictionary.</p>
  
  <p>I'm using a string formatter for building paths from templates.</p>
  
  <p>I know I can do this:</p>
  
  <pre><code>currentUser = {'first': "Monty", 'last': "Python"}
  template = '/usr/{user[last]}/{user[first]}' # will come from a config file
  template.format(user=currentUser)
  # Result: '/usr/Python/Monty'
  </code></pre>
  
  <p>but in the case of </p>
  
  <pre><code>currentUser = {'first': "Raymond", 'last': "Luxury-Yacht"}
  </code></pre>
  
  <p>Is there a way to split, say, by <code>-</code> and use an index?</p>
  
  <pre><code># something like:
  template = '/usr/{user[last].split(-)[0]/{user[first]}' # will come from a config file
  template.format(user=currentUser)
  # Result: '/usr/Luxury/Raymond'
  </code></pre>
  
  <p>The decision to choose:</p>
  
  <ul>
  <li>which key to split </li>
  <li>by what character </li>
  <li>which index to use from split </li>
  </ul>
  
  <p><strong>MUST come from the template string</strong>; if the current mini-language can't achieve this, I will have to write a custom formatter.</p>
  
  <p>DISCLAIMER: The example is a bit contrived, and not practical, I know.  I'm actually dealing with a database where two key bits of information are stored in a single field, joined by underscores -_-.  I understand that I could do post-processing on the data after extracting it from the database, but due to conventions for this field differing per-project, I can't even assume that a split operation is valid (some values on some projects won't have the underscore issue).  Rather than code a solution around each convention, I'm hoping to be able to provide users with a template "language" so each project can themselves determine how to extract that data, adapt to whatever naming convention they choose, and configure their templates accordingly.</p>
  
  <p>TL/DR: I'm not looking for a solution to fixing my incoming data -- I'm exploring the possibility of splitting strings <strong>using Python's string format mini-language</strong>.</p>