37,719
社区成员
发帖
与我相关
我的任务
分享
import time
from threading import Thread
def a():
while True:
with open("a.txt", "a") as fa:
fa.write("Hello Python! {}".format(time.ctime()))
threads_list = []
for item in range(0, 500):
threads_list.append(Thread(target=a))
for t in threads_list:
t.start()
for t in threads_list:
t.join()