title: unconverted data remains: .387000 in Python
body: <p>I have a datetime that is a string I read from a text file.  I want to trim the extra milliseconds off of it, but I want to convert it to a datetime variable first.  This is because it may be in different formats depending on what is in the text file.  How ever, everything I have tried wants me to already know the format.  Please take a look at what I am trying here:</p>
  
  <pre><code>import time, datetime
  
  mytime = "2015-02-16 10:36:41.387000"
  myTime = time.strptime(mytime, "%Y-%m-%d %H:%M:%S.%f")
  
  myFormat = "%Y-%m-%d %H:%M:%S"
  
  print datetime.datetime.fromtimestamp(time.mktime(time.strptime(mytime, myFormat)))
  </code></pre>
  
  <p>But this gives me this error: </p>
  
  <pre><code>File "python", line 10, in &lt;module&gt;
  ValueError: unconverted data remains: .387000`
  </code></pre>
  
  <p>Can someone please tell me how to do a normal datetime format?  In other languages I can pass in various formats and then set it to a new format without a problem.</p>