所以我想打包一个元组的列表,然后稍后解压它。
from struct import *
from itertools import chain
a = [(1, 67), (213, 455), (9009, 8887)]
# converts 3x2 list to 6x1 list
b = list(chain(*a))
size=6
qq = pack('h'+'L'*size,size,*b)
# peak to get the list length
mysize = unpack('h',qq[:2])
mysize = m
运行以下代码时没有出错,但数据库不影响。这意味着记录不能删除。Python代码的一部分
import MySQLdb as msdb
def delete_row(self):
con = msdb.connect('localhost','root','24434','matab_db')
cur = con.cursor()
qq = "DELETE FROM tbl_rezerv_nobat WHERE id=4"
# or qq = "DELETE FROM tbl_