datetime format does not match with content
<p>I have checked quite a lot of questions related to this topic but I'm not able to find my error. </p>

<p>My code can be simplified to:</p>

<pre><code>date = "2016/07/20"
time = "11:44:20.920"

date_time = datetime.strptime(date + " " + time, '%y/%m/%d %H:%M:%S.%f')
</code></pre>

<p>The error I get is the following:</p>

<pre><code>Traceback (most recent call last):
  File "adma_shortener.py", line 50, in &lt;module&gt;
    adma_time[ii] = datetime.strptime(a, '%y/%m/%d %H:%M:%S.%f').replace(microsecond=0)
  File "/usr/lib/python2.7/_strptime.py", line 325, in _strptime
    (data_string, format))
ValueError: time data '2016/07/20 11:44:20.920' does not match format '%y/%m/%d %H:%M:%S.%f'
</code></pre>

<p>Can someone see my error? 
Thanks in advance</p>

<p>If you are not very familiar with the <a href="https://docs.python.org/2/library/time.html#time.strftime" rel="nofollow">datetime directives</a>, I will suggest you to use <a href="http://dateutil.readthedocs.io/en/stable/parser.html" rel="nofollow"><code>dateutil.parser</code></a> instead. It is much simpler. For example:</p>

<pre><code>&gt;&gt;&gt; import dateutil.parser
&gt;&gt;&gt; date = "2016/07/20"
&gt;&gt;&gt; time = "11:44:20.920"
&gt;&gt;&gt; my_date = dateutil.parser.parse('{date} {time}'.format(date=date, time=time))
&gt;&gt;&gt; my_date
datetime.datetime(2016, 7, 20, 11, 44, 20, 920000)
</code></pre>

python datetime