python 多线程如何延时
1个回答
展开全部
import time
from threading import Thread
## 定时输入
class k(object):
x=0
sleepTime=0
def __init__(self,sleepTime=0):
self.sleepTime=sleepTime
self.input_delay_test()
def input_delay(self):
self.x=input("please input\n")
def input_delay_test(self):
thd=Thread(target=self.input_delay)
thd.daemon=True
thd.start()
time.sleep(self.sleepTime)
print(self.x,self.sleepTime,sep=' ')
[print(x,end=' ') for x in range(10)]
k(4)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询