■ Thread 클래스 : 스레드 사용하기

----------------------------------------------------------------------------------------------------

import threading

import time

 

def say(message):

    while True:

        time.sleep(1)

        print(message)

 

for message in ["you", "need", "python"]:

    t = threading.Thread(target = say, args = (message,))

    t.daemon = True

    t.start()

 

for i in range(100):

    time.sleep(1)

    print(i)

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker