python - mysqldb中的批量插入会复制一份列表吗?
PHP中文网
PHP中文网 2017-04-18 09:40:54
0
1
801
def ins(values):
    cur.executemany('insert into test values(%d,%s,%s,%d)',values)
    conn.commit()
if count==3600:
    t3 = threading.Thread(target=ins,args=(values,))
    t3.start()
    values=[]

执行executemany时他会复制一份列表吗?
我考虑在创建进程时用args=(values[:]),但如果自带复制的话就是浪费资源了

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
小葫芦

executemany itself will not copy another copy of values.
And the values ​​are only read-only operations. I don’t know why we need to make a copy when creating a process?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template