import threading
import time
g_list = list()
def add_list():
for item in range(5):
g_list.append(item)
print(item)
time.sleep(0.2)
pass
pass
def read_list():
print(g_list)
pass
if __name__ == '__main__':
add_thread = threading.Thread(target=add_list)
add_thread.start()
# 当前进程等待add_thread进程执行完之后,才能够往下执行
add_thread.join()
read_thread = threading.Thread(target=read_list)
read_thread.start()