title: save multi thread output to txt file
body: <p>i write this simple code ... i need to save the code output to text file in my pc how i can do that ? </p>
  
  <pre><code>import threading
  import time
  
  
  def qan(hey):
      while True:
  
          d = hey + 1
          print d
          time.sleep(1)
  
  
  def printd(printme):
      while True:
          print printme + "\n"
          time.sleep(1)
  
  
  t1 = threading.Thread(target=qan, args=(1,))
  t2 = threading.Thread(target=printd, args=("hey",))
  t2.start()
  t1.start()
  </code></pre>
  
  <p>and this is my code output </p>
  
  <blockquote>
    <p>hey</p>
    
    <p>2 2  hey</p>
    
    <p>2hey</p>
    
    <p>2</p>
  </blockquote>