标签:顺序 过程 cti begin 共享内存 应用程序 sleep name 不能
import threading
import time
def sing():
    print("begin to sing            %s" % time.ctime())
    time.sleep(3)
    print("stop to sing             %s" % time.ctime())
    
def jump():
    print("begin to jump            %s" % time.ctime())
    time.sleep(5)
    print("stop to jump             %s" % time.ctime())
    
def rap():
    print("begin to rap             %s" % time.ctime())
    time.sleep(7)
    print("stop to rap              %s" % time.ctime())
def play_basketball():
    print("begin to play_basketball  %s" % time.ctime())
    time.sleep(9)
    print("stop to play_basketball   %s" % time.ctime())
    
    
if __name__ == '__main__':
    #开启sing的线程
    t1 = threading.Thread(target = sing)
    t1.start()
    #开启jump的线程
    t2 = threading.Thread(target = jump)
    t2.start() 
    #开启rap的线程
    t3 = threading.Thread(target = rap)
    t3.start()
    #开启篮球的线程
    t4 = threading.Thread(target = play_basketball)
    t4.start() 

标签:顺序 过程 cti begin 共享内存 应用程序 sleep name 不能
原文地址:https://www.cnblogs.com/hyxk/p/11279104.html