python 多线程传参有点奇怪记录一下
import threadsql1 = 'select 1'sql2 = 'select 2'def run(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()
posted on 2019-03-23 11:59 阅读( ...) 评论( ...)