from threading import Thread
def work1(nums):
nums.append('a')
print('---在work1中---',nums)
def work2(nums):
print("-----在work2中----,",nums)
if __name__ == '__main__':
g_nums = [1,2,3]
t1 = Thread(target=work1,args=(g_nums,))
# target函数,args参数
t1.start()
t2 = Thread(target=work2,args=(g_nums,))
t2.start()
2020-05-07