擅长:python、mysql、java
<p>这将为您提供以秒为单位的时间差:</p>
<pre><code>print(diffrence.total_seconds())
</code></pre>
<p>示例:</p>
^{pr2}$
<p>输出:</p>
<pre><code>31536000.0
</code></pre>
<p>看起来不错:</p>
<pre><code>print(365 * 24 * 60 * 60)
31536000
</code></pre>
<p>从<a href="https://docs.python.org/3.5/library/datetime.html?highlight=datetime#datetime.timedelta.total_seconds" rel="nofollow noreferrer">docs</a>:</p>
<blockquote>
<p>Total seconds in the duration.</p>
</blockquote>