document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #!/usr/bin/python
  2. import thread
  3. import time
  4.  
  5. # this is the function we are using for thread creation
  6. def func(ThreadName,delay):
  7.     print("%s started its execution now"%(ThreadName))
  8.     count=0
  9.     while count<5:
  10.         count=count+1
  11.         print("Iteration no : %d"%int(count)+" Name :%s"%ThreadName +" Time :%s"%(time.ctime(time.time())))
  12.         time.sleep(delay)
  13.  
  14.     print("------------- %s has now finished executing ---------------"%ThreadName)
  15.  
  16.  
  17.  
  18. # now we have to start threads that use this func() method
  19.  
  20. thread.start_new_thread(func,("FIRST THREAD",3))
  21. thread.start_new_thread(func,("SECOND THREAD",5))
  22. print(" ******************  All the tasks have finished executing *******************************")
  23.  
  24. while True:
  25.     pass
');