---
title: "Discussion on \"Python: 可中斷的 Sleep\" | Hashnode"
description: "Discussion on \"Python: 可中斷的 Sleep\". 在 Python 裡面，有個很好用的函數，叫做 time.sleep ，他可以讓程式暫停幾秒，不過要讓程式更好，需要再對 “Sleep” 更了解一些。\n用途\n就我來說，會用到的情況不外乎這幾種：\n\n需要 polling 的等待函數\n定期執行程式的 cronjob\n暫時性的等待資源的 work around。\n\n# 只是一個 Polling 陽春的範例  \ndef wait_for_data():"
url: "https://hashnode.com/posts/python-interrupt-sleep/624bb9dc2b09bb392ea5c037"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Python: 可中斷的 Sleep](https://notes.mukyu.dev/python-interrupt-sleep?utm_source=hashnode&utm_medium=feed)

在 Python 裡面，有個很好用的函數，叫做 time.sleep ，他可以讓程式暫停幾秒，不過要讓程式更好，需要再對 “Sleep” 更了解一些。 用途 就我來說，會用到的情況不外乎這幾種： 需要 polling 的等待函數 定期執行程式的 cronjob 暫時性的等待資源的 work around。 # 只是一個 Polling 陽春的範例 def wait\_for\_data():

Feb 10, 2022 · 1 min read · notes.mukyu.dev  
Updated Oct 27  
Read the article

-   [#python3](https://hashnode.com/tag/python3)
-   [#python](https://hashnode.com/tag/python)

## Written by

[Patchouli](https://hashnode.com/@mudream4869)

@mudream4869 · Uohout

  
[View profile](https://hashnode.com/@mudream4869)

工程師帕秋莉~

後端工程師。 不定時張貼一些寫扣時的筆記，有時英文，有時中文。 「如果，我是魔女的話...」

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
