python 多线程如何延时
发布网友
发布时间:2022-04-22 23:41
我来回答
共1个回答
热心网友
时间:2023-06-13 06:58
灞曞紑鍏ㄩ儴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)