title: Get filename and date time from string
body: <p>I have file names in the following format: name_2016_04_16.txt</p>
  
  <p>I'm working with python3 and I would like to extract two things from this file. The prefix, or the name value as a string and the date as a DateTime value for the date represented in the string. For the example above, I would like to extract:</p>
  
  <p>filename: name as a String  </p>
  
  <p>date: 04/16/2016 as a DateTime </p>
  
  <p>I will be saving these values to a database, so I would like the DateTime variable to be sql friendly.</p>
  
  <p>Is there a library that can help me do this? Or is there a simple way of going about this?</p>
  
  <p>I tried the following as suggested:</p>
  
  <pre><code>filename = os.path.splitext(filename)[0]
          print(filename)
          filename.split("_")[1::]
          print(filename)
          '/'.join(filename.split("_")[1::])
          print(filename)
  </code></pre>
  
  <p>But it outputs:  </p>
  
  <pre><code>name_2016_04_16  
  name_2016_04_16  
  name_2016_04_16
  </code></pre>
  
  <p>And does not really extract the name and date.</p>
  
  <p>Thank you!</p>