def a():
base = open(str(sys.args[1])).read().splitlines()
for a in base:
действие над строчкой
from multiprocessing.pool import ThreadPool as Pool
# from multiprocessing import Pool
from random import randint
from time import sleep
def process_line(l):
print l, "started"
sleep(randint(0,3))
print l, "done"
def get_next_line():
with open("sample.csv",'r') as f:
for line in f:
yield line
f = get_next_line()
t = Pool(processes=8)
for i in f:
t.map(process_line, (i,))
t.join()
t.close()