from concurrent.futures import ProcessPoolExecutor
from time import sleep
def process(arg):
key, index, value = arg
print("executing", key, value)
sleep(1)
return key, index, value * 10
if __name__ == "__main__":
D = {'x': [1, 2, 3], 'y': [4, 5, 6], 'z': [7, 8, 9]}
L = []
for key, value in D.items():
for index in range(len(value)):
L.append((key, index, value[index]))
with ProcessPoolExecutor(2) as executor:
result = executor.map(process, L)
for x, y, z in result:
D[x][y] = z
print(D)
bin2hex преобразует вообще все символы, а мне надо только отсутствующие в ASCII.