From insect
import threading
from time import ctime,sleep
import time
from selenium import webdriver
def music():
for i in range(100):
print i
time.sleep(1)
t = threading.Thread(target=music)
if __name__ == '__main__':
t.setDaemon(True)
t.start()
time.sleep(3)
print "all over %s" %ctime()
Copy the code
Thread exit: thred.exit()