为什么只有一个线程被执行而另一个没有被执行

时间:2016-08-18 08:24:06

标签: python python-multithreading

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()

1 个答案:

答案 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()

target = auto1() - >目标= AUTO1