import threading
import time
def thread_function(num):
print(f"start thread {num}")
time.sleep(5)
print(f"stop thread {num}")
for a in range(5):
x = threading.Thread(target=thread_function, args=(a,))
x.start()
while threading.active_count() > 1:
print(f"\rnb thread : {threading.active_count()}", end='', flush=True)
time.sleep(1)
print('fini')