【发布时间】:2015-07-24 19:36:50
【问题描述】:
我正在尝试将数据发布到表的名称是变量的表中,我没有收到任何错误,但是没有数据正在发布。
cursor = db.cursor()
cursor.execute('DROP TABLE IF EXISTS %s' %data[1])
0L
sql ="""CREATE TABLE %s (IP TEXT, AVAILIBILITY INT)""" %data[1]
cursor.execute(sql)
0L
for key in data[0]:
print type(key), type(data[0][key])
sql = """INSERT INTO %s VALUES (%s,%s)""" %(data[1],key,data[0][key])
【问题讨论】:
-
你
db.commit()吗? -
你是对的,我没有使用 db.commit() 这使得运行时需要更长的时间,我认为它可以工作,但它仍然没有发布
标签: python mysql-python