title: How to get string before hyphen
body: <p>I have below filename:</p>
  
  <pre><code>pagecounts-20150802-000000
  </code></pre>
  
  <p>I want to extract the date out of above <code>20150802</code>
  I am using the below code but its not working:</p>
  
  <pre><code>print os.path.splitext("pagecounts-20150802-000000")[0]
  </code></pre>