ens*_*are 7 python-multithreading python-3.x python-multiprocessing
我有一个非常大的目录,想要递归,将文件发送到发现并行处理的多处理队列。
PATH = "/mnt/large_directory"
def main():
#Initialize
print("Starting the scanner in root " + PATH)
with os.scandir(PATH) as it:
for entry in it:
if not entry.name.startswith('.') and entry.is_file():
print(entry.name)
print(entry.path)
Run Code Online (Sandbox Code Playgroud)
我需要使用一个函数来对每个文件执行工作:
def doWork()
//Calculates md5 sum and other check sums
Run Code Online (Sandbox Code Playgroud)
执行此操作的正确方法是什么,以便在工作线程可用时将文件添加到发现的多处理队列中?
| 归档时间: |
|
| 查看次数: |
340 次 |
| 最近记录: |