title: Python threading - do something while join()
body: <p>Python 2.6.6</p>
  
  <p>I hava a list of threads to be executed and the main code will wait (Threading.join()) until they're all finished.</p>
  
  <pre><code>&gt;&gt;&gt; for thread in threadList:
  ...     thread.start()
  &gt;&gt;&gt; for t in threadList:
  ...     t.join()
  </code></pre>
  
  <p>Is there a way to print messages like "running..." while the main code waits the end of the threads?</p>
  
  <p>I want to print the same thing ("running...") second after second until the threads are all done.</p>
  
  <p>Thanks.</p>
  
  <hr>
  
  <p><strong>SOLVED</strong></p>
  
  <p>Implemented solution:</p>
  
  <pre><code>&gt;&gt;&gt; for thread in threadList:
  ...     thread.start()
  &gt;&gt;&gt; string = "running"
  &gt;&gt;&gt; while any(t.is_alive() for t in threadList):
  ...    sys.stdout.write("\r%s" % string)
  ...    sys.stdout.flush()
  ...    string = string + "."                     #this may not be the best way
  ...    time.sleep(0.5)
  </code></pre>
  
  <p>In my case, the extra time of "time.sleep(0.5)" is not an issue, although it's not the most recommended.</p>
  
  <p>This generates the output:</p>
  
  <pre><code>running........
  </code></pre>
  
  <p>The dots after "running" will be printed one after one, on the same line, while there is any thread alive. Exactly as I expected!</p>
  
  <p>Based on the answers of @Manuel Jacob and @Alex Hall.</p>