title: how to get the last part of a string before a certain character?
body: <p>I am trying to print the last part of a string before a certain character.  </p>
  
  <p>I'm not quite sure whether to use the string .split() method or string slicing or maybe something else.    </p>
  
  <p>Here is some code that doesn't work but I think shows the logic:  </p>
  
  <pre><code>x = 'http://test.com/lalala-134'
  print x['-':0] # beginning at the end of the string, return everything before '-'
  </code></pre>
  
  <p>Note that the number at the end will vary in size so I can't set an exact count from the end of the string.  </p>