title: Python: Get URL path sections
body: <p>How do I get specific path sections from a url? For example, I want a function which operates on this: </p>
  
  <pre><code>http://www.mydomain.com/hithere?image=2934
  </code></pre>
  
  <p>and returns "hithere"</p>
  
  <p>or operates on this:</p>
  
  <pre><code>http://www.mydomain.com/hithere/something/else
  </code></pre>
  
  <p>and returns the same thing ("hithere")</p>
  
  <p>I know this will probably use urllib or urllib2 but I can't figure out from the docs how to get only a section of the path.</p>