擅长:python、mysql、java
<p><code>datetime.datetime.now</code>只引用方法,但不调用它。它应该是<code>str(datetime.datetime.now())</code>或:</p>
<pre><code>time = datetime.datetime.now()
time.strftime('%m/%d/%Y') #formats the date as a string
</code></pre>
<p>有关格式化<a href="https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior" rel="nofollow noreferrer">here</a>的详细信息</p>
<p>引用上一个问题<a href="https://stackoverflow.com/questions/10624937/convert-datetime-object-to-a-string-of-date-only-in-python">here</a></p>