#并行:真的多任务,任务数小于cpu核数
#并发:假的多任务,任务数大于cpu核数
import threading
import time
def sing():
for i in range(5):
print("singing")
time.sleep(1)
def Dance():
for i in range(5):
print("Dance")
time.sleep(1)
def main():
t1=threading.Thread(target=sing)
t2=threading.Thread(target=Dance)
t1.start()#启动线程,即让线程开始执行
t2.start()
if __name__=="__main__":
main()