2016-08-18 1 views
0
import threading,time 

def auto2(): 

    while 1: 
     print ("hello master") 
     time.sleep(2) 

def auto1(): 

    while 1: 
     print "hello" 
     time.sleep(3) 

x=threading.Thread(target=auto1(),args=()) 

y=threading.Thread(target=auto2(),args=()) 

x.start() 

y.start() 
+0

모두에게 명확하게하기 위해, 심지어 당신의 예상되는 동작과 실제 동작을 설명하시기 바랍니다 코드가 단순하다면. –

답변

1
import threading, time 
def auto2(): 
    while 1: 
     print("hello master") 
     time.sleep(2) 
def auto1(): 
    while 1: 
     print ("hello") 
     time.sleep(3) 
x = threading.Thread(target=auto1) 
y = threading.Thread(target=auto2) 
x.start() 
y.start() 

대상 = AUTO1()하지 도착한다 -> 대상 = AUTO1

+0

은 필요한 인수이며 언제 사용됩니까? – Perseus784

관련 문제