Py学习  »  Python

Python只在SQLite数据库中插入一行

Carlos • 6 年前 • 1704 次点击  

为什么我的代码只插入一行?

thewholeenchilada = ("SELECT SUBSTR(email, (SELECT INSTR(email,'@'))) AS org, SUM(count) as count FROM Em GROUP BY org ORDER BY count DESC")

for salida in cur.execute(thewholeenchilada):
    cur.execute('''INSERT INTO Counts (org, count)
                VALUES (?, ?)''', (salida[0],row[1]))

    print((str(salida[0]), salida[1]))
    conn.commit()
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/50907
文章 [ 1 ]  |  最新文章 6 年前