2007年06月11日 星期一 17:12
是不是插入完数据后cur发生了变化? ----- Original Message ----- From: zuggie To: python-chinese在lists.python.cn Sent: Monday, June 11, 2007 4:52 PM Subject: [python-chinese] IndexError: list index out of range 大家好,我用如下代碼: for j in range(cur.rowcount): spc_sql = "INSERT " + spc_table + "(Cust, Family, Sku, WorkOrder, Line, Station, \ ProdCode, ScanTime, UserID, Status, FailLine, FailStation, FailTime, FailCode, \ FailLocation, FailPoint, FailArea, FailStationType, FailType, ActionCode, \ ActionTime, ActionBy, FailPart, OutRepairTime, OutRepairBy) VALUES('%s', '%s', \ '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', \ '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')" % (colcount[0 + 25 * j], \ colcount[1 + 25 * j], colcount[2 + 25 * j], colcount[3 + 25 * j], colcount[4 + 25 * j], \ colcount[5 + 25 * j], colcount[6 + 25 * j], colcount[7 + 25 * j], colcount[8 + 25 * j], \ colcount[9 + 25 * j], colcount[10 + 25 * j], colcount[11 + 25 * j], colcount[12 + 25 * j], \ colcount[13 + 25 * j], colcount[14 + 25 * j], colcount[15 + 25 * j], colcount[16 + 25 * j], \ colcount[17 + 25 * j], colcount[18 + 25 * j], colcount[19 + 25 * j], colcount[20 + 25 * j], \ colcount[21 + 25 * j], colcount[22 + 25 * j], colcount[23 + 25 * j], colcount[24 + 25 * j]) 確定 cur.rowcount 的值大於 1000,但是在實際操作時,當第一行插入數據庫完成,執行第二行 時,就會報錯:IndexError: list index out of range。看了半天,沒發現那裏錯誤,大家幫忙看下 錯誤在哪兒,謝謝。 ------------------------------------------------------------------------------ _______________________________________________ python-chinese Post: send python-chinese在lists.python.cn Subscribe: send subscribe to python-chinese-request在lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese -------------- 下一部分 -------------- 一个HTML附件被移除... URL: http://python.cn/pipermail/python-chinese/attachments/20070611/780c9345/attachment.html
Zeuux © 2025
京ICP备05028076号