Skip to main content
 首页 » 编程设计

Python线程结构

2024年10月25日8zfyouxi

<分区>

我读过一些这样的代码。

def bind(): 
    while True: 
        line = raw_input() 
        #do something 
 
def worker(): 
    print "i'm working" 
    #do something 
 
th = threading.Thread(target=worker) 
th.daemon = True  
th.start() 
time.sleep(0.5) 
bind() 

worker 是什么意思?为什么不使用

th = threading.Thread(target=bind)