import threading
import time
num = 0
def first():
for item in range(100000):
global num
num = num + 1
pass
print(num)
pass
def second():
for item in range(100000):
global num
num = num + 1
pass
print(num)
pass
if __name__ == '__main__':
first_thread = threading.Thread(target=first)
second_thread = threading.Thread(target=second)
first_thread.start()
# 解决方法
first_thread.join()
second_thread.start()