擅长:python、mysql、java
<p>我已通过删除嵌套for循环来更正错误</p>
<blockquote>
<p>Replaced the following</p>
</blockquote>
<pre><code># Read the file contents in to the table
with open(fileName, accessMode) as publicHolidays :
listOfPublicHolidays = csv.reader(publicHolidays)
for currentRow in listOfPublicHolidays :
for currentEntry in currentRow :
c.execute('INSERT INTO holidays VALUES (?, ?, ?, ?, ?)', currentEntry)
</code></pre>
<blockquote>
<p>With the following</p>
</blockquote>
<pre><code>with open(fileName, accessMode) as publicHolidays :
listOfPublicHolidays = csv.reader(publicHolidays)
for currentRow in listOfPublicHolidays :
c.execute('INSERT INTO holidays VALUES (?, ?, ?, ?, ?)', currentRow)
</code></pre>
<p>但是我仍然不清楚错误的原因。你知道吗</p>