title: Extracting pieces from URL in python
body: <p>I am iterating over multiple URLs in a csv file; the URLs have the next structure:</p>
  
  <pre><code>http://www.parool.nl/parool/nl/4024/AMSTERDAM-CENTRUM/article/detail/3751723/2014/09/21
  http://www.parool.nl/parool/nl/5/POLITIEK/article/detail/3751624/2014/09/20/VVD-wil-  boete-van-250-euro-voor-het-naroepen-van-vrouwen.dhtml
  </code></pre>
  
  <p>etc., </p>
  
  <p>I need to get the article category (after the 4th slash, "AMSTERDAM-CENTRUM" and "POLITIEK", in this case), and append them to a list.</p>
  
  <p>I'm working with urllib2:</p>
  
  <pre><code>reader=CsvUnicodeReader(open("my.csv","r"))
  for row in reader:
      url = row[0]
      req=urllib2.Request(url)
  </code></pre>
  
  <p>Is there a way to parse the URL? </p>