亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

python如何手動實(shí)現(xiàn)阻塞
伊謝爾倫
伊謝爾倫 2017-04-18 10:31:04
0
2
639

python 如何手動實(shí)現(xiàn)阻塞?

令py腳本一直阻塞直到強(qiáng)制退出(KeyboardInterrupt)

之前用

while True:
    pass

發(fā)現(xiàn)cpu占用太高了。。。

伊謝爾倫
伊謝爾倫

小伙看你根骨奇佳,潛力無限,來學(xué)PHP伐。

Antworte allen(2)
PHPzhong

1. 使用time.sleep

while True:
    # 等待一年
    time.sleep(60*60*24*365)
    
# 直接等待一百年
time.sleep(60*60*24*365*100)

2.使用threading.Condition

condition=threading.Condition()
condition.acquire()
condition.wait()

2.使用等待鍵盤響應(yīng)

Python實(shí)現(xiàn)按任意鍵繼續(xù)

黃舟
while True:
    time.sleep(1)
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage