title: Splitting a url into a list in python
body: <p>I am currently working on a project that involves splitting a url. I have used the urlparse module to break up the url, so now I am working with just the path segment. </p>
  
  <p>The problem is that when I try to split() the string based on the delimiter "/" to separate the directories, I end up with empty strings in my list. </p>
  
  <p>For example, when I do the following: </p>
  
  <pre><code>import urlparse
  url = "http://example/url/being/used/to/show/problem"
  parsed = urlparse.urlparse(url)
  path = parsed[2] #this is the path element
  
  pathlist = path.split("/")
  </code></pre>
  
  <p>I get the list: </p>
  
  <pre><code>['', 'url', 'being', 'used', 'to', 'show', 'problem']
  </code></pre>
  
  <p>I do not want these empty strings. I realize that I can remove them by making a new list without them, but that seems sloppy. Is there a better way to remove the empty strings and slashes?</p>