title: Python multi-threading file processing
body: <p>I have few files that resides on a server, im trying to implement a multi threading process to improve the performance, I read a tutorial but have few questions implementing it, </p>
  
  <p>Here are the files,</p>
  
  <pre><code>filelistread = ['h:\\file1.txt', \
                  'h:\\file2.txt', \
                  'h:\\file3.txt', \
                  'h:\\file4.txt']
  
  filelistwrte = ['h:\\file1-out.txt','h:\\file2-out.txt','h:\\file3-out.txt','h:\\file4-out.txt']
  
  
  def workermethod(inpfile, outfile):
      f1 = open(inpfile,'r')
      f2 = open(outfile,'w')
      x = f1.readlines()
      for each in x:
          f2.write(each)
      f1.close()
      f2.close()
  </code></pre>
  
  <p>How do I implement using the thread class and queue?</p>
  
  <p>I started with the below class but not sure how to pass the inpfile and outputfile to the run method..Any inputs are appreciated</p>
  
  <pre><code>class ThreadUrl(threading.Thread):
      def __init__(self,queue):
          threading.Thread.__init__(self)
          self.queue = queue
  
      def run(self):
          while True:
              item = self.queue.get()
  </code></pre>