#coding=utf-8#!/usr/bin/pythonimport threadimport time# 為線程定義一個(gè)函數(shù)def print_time( threadName, delay): count = 0 while count < 5: time.sleep(delay) count += 1 print "%s: %s" % ( threadName, time.ctime(time.time()) )# 創(chuàng)建兩個(gè)線程try: thread.start_new_thread( print_time, ("Thread-1", 2, ) ) thread.start_new_thread( print_time, ("Thread-2", 4, ) )except: print "Error: unable to start thread"while 1: pass為毛去掉while 1:
pass線程定義的函數(shù) print_time 就不執(zhí)行了呢
幫我看看這個(gè)python 是為什么
jeck貓
2018-07-17 08:11:06