title: How to split elements in a list and get date and time from a list
body: <p>Since the beginning of time I have been struggling with importing files in Python  and reading lines in a optimal way.
  For example, a file I have is as follows:</p>
  
  <pre><code>2015 02 25    09:00:00
  A second line
  One more line
  </code></pre>
  
  <p>Now I want to extract the date and time from the first line; for this we want it in this format I think, to make it work in the datetime module</p>
  
  <pre><code>(2015,02,25,09,00,00)
  </code></pre>
  
  <p>This is what I have</p>
  
  <pre><code>with open('file.txt', newline='') as inputfile:
    data = inputfile.readlines()
    print(data[0])
  Out: ['2015 02 25    09:00:00']
  </code></pre>
  
  <p>This gives us the first element of the list. Now I want to make a comma separated list out of this. Now when I try this for example:</p>
  
  <pre><code>In: datetime = [i.split(':') for i in file[0]]
  Out: [['2015 02 25    09', '00', '00']]
  </code></pre>
  
  <p>I get a list of lists, which does not make things easier in any way. And we haven't even split the whitespaces yet. What is the best way to get the date and time out of this? 
  And more in general, do you know any good tutorials to practice list/string splitting, iterate over text files/lists etc. </p>