Форум сайта python.su
Добрый день.
sem = threading.Semaphore(S_THREADS) thr_lst = [] for ind, mail_to in enumerate(mail_list): if ind > 0 and ind % int(S_COUNTER_OF_SENT_EMAILS) == 0: send_for_my_email() print(f'Pause time = {S_PAUSE_TIME} sec') time.sleep(S_PAUSE_TIME) thr = threading.Thread( target=run_smtp_send_with_semaphore, args=(mail_to, sem), daemon=True ) thr_lst.append(thr) thr.start() [i_thr.join() for i_thr in thr_lst]
Офлайн