python 多线程传参有点奇怪记录一下
import thread
sql1 = 'select 1'
sql2 = 'select 2'
def execute(sql):
print sql
# 说明 :target 后面是方法名(不要带参数) 而参数要写在args里面并且要多一个逗号
if __name__ == '__main__':
t1 = threading.Thread(target=execute, args=(sql1,))
t2 = threading.Thread(target=execute, args=(sql2,))
t1.start()
t2.start()