python commit 在mysql innodb中的用法

http://stackoverflow.com/questions/6482004/pythonmysql-bulk-insert
con = mysqldb.connect(
                        host="localhost",
                        user="user",
                        passwd="**",
                        db="db name"
                     )
cur = con.cursor()

for data in your_data_list:
    cur.execute("data you want to insert: %s" %data)

con.commit()
con.close()

放在每句execute后面,加快执行

你可能感兴趣的:(python)