擅长:python、mysql、java
<p>在第一个函数中传递给<code>datetime.date(a)</code>的参数<code>a</code>与调用<code>datetime.date()</code>类似</p>
<pre><code>datetime.date((2018,6,19,0,0,0))
</code></pre>
<p>这是一个<code>tuple</code>。您可以使用</p>
<pre><code>def epochConverter(a):
return datetime(*a).timestamp()
</code></pre>
<p>(这里不需要转换<code>mydate = datetime.date(a)</code>)</p>
<p>或者您需要使用以下命令分别传递所有参数:</p>
<pre><code>def epochConverter(Y, M, D, h, m, sec):
return datetime(Y, M, D, h, m, sec).timestamp()
epochConverter(2018, 6, 19, 0, 0, 0)
</code></pre>