This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Python Threading

By: ionutHulub on Mar 9th, 2013  |  syntax: Python  |  size: 0.25 KB  |  views: 5  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import threading
  2. from time import sleep
  3.  
  4. def one():
  5.         while True:
  6.                 print 'ello'
  7.                 sleep(2)
  8.  
  9. def two():
  10.         while True:
  11.                 raw_input()
  12.  
  13. t1 = threading.Thread(target=one)
  14. t2 = threading.Thread(target=two)
  15. t1.start()
  16. t2.start()
  17. t1.join()
  18. t2.join()
clone this paste RAW Paste Data