I have a huge file with hundreds of thousands of lines. I need to run the same process on each line. My plan was to make several threads to speed up the process. Whenever I multithreaded before I used treading and Queue modules. However I cannot figure out how to apply a queue. What I really need to do is read the file line by line, as the file is too large to do the whole thing. I thought that maybe I could just add one thing to the queue at a time with .put(), then immediately pass it to the thread, but it seems like if I did this the threads could conflict. Any suggestions?
質問する
294 次