pythonマルチスレッド-demo

355 ワード

import threading

def thread_num(ss, num):
    total = len(ss)
    split_data = [ss[i: i + int(total/num)] for i in range(0, len(ss), int(total/num))]
    for d in split_data:
        t = threading.Thread(target=func, args=(d,))
        t = t.start()

    while threading.active_count()!=1:
        pass

thread_num(ss, 100)