擅长:python、mysql、java
<pre><code>cur.execute('insert into new_test (curent_dt) values (? )', (temp))
</code></pre>
<p>将此代码替换为</p>
<pre><code>cur.execute('insert into new_test (curent_dt) values (? )', (temp,))
</code></pre>
<p>在Python中,(temp)和(temp,)是两个不同的东西。(temp)和integer一样只是一个普通变量,但(temp,)是一个元组。元组只能通过在每个元素后面提供逗号来获取,execute()方法只在其第二个参数中获取元组。</p>