Python异步写入文件(multiprocessing template)

迁移地址:http://vongola.tk/code-template/

点击这里

#multiprocessing template
import multiprocessing

def write_file(result):
    f = open('')
    f.write(result)

def process(args):
    '''
    work
    '''
    return result

if __name__ == '__main__':
    pool = multiprocessing.Pool(processes = 100)
    for t in tasks:
        pool.apply_async(process, (t, ),callback=write_file)
    pool.close()
    pool.join()

你可能感兴趣的:(Python)