convert linux python multiprocessing to windows -
i use linux python script in windows python.
how rewrite ? part rewritten in multiprocessing part.
from __future__ import print_function collections import counter import glob import multiprocessing import os import re import sys import time def create_data(filepath): ... return values filepaths = glob.glob('*/*.txt') num_tasks = len(filepaths) p = multiprocessing.pool() results = p.imap(create_data, filepaths) while (true): completed = results._index print("\r--- completed {:,} out of {:,}".format(completed, num_tasks), end='') sys.stdout.flush() time.sleep(1) if (completed == num_tasks): break p.close() p.join() df_full = pd.dataframe(list(results)) print()
thanks help.
Comments
Post a Comment