{"id":1091337,"date":"2025-01-08T14:10:41","date_gmt":"2025-01-08T06:10:41","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1091337.html"},"modified":"2025-01-08T14:10:44","modified_gmt":"2025-01-08T06:10:44","slug":"python%e5%ae%9a%e6%97%b6%e5%99%a8%e5%a6%82%e4%bd%95%e6%8e%a7%e5%88%b6%e5%90%af%e5%81%9c-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1091337.html","title":{"rendered":"python\u5b9a\u65f6\u5668\u5982\u4f55\u63a7\u5236\u542f\u505c"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24203555\/dd79cba9-f9cb-4c61-b4cd-310a14bb07b1.webp\" alt=\"python\u5b9a\u65f6\u5668\u5982\u4f55\u63a7\u5236\u542f\u505c\" \/><\/p>\n<p><p> <strong>Python\u5b9a\u65f6\u5668\u5982\u4f55\u63a7\u5236\u542f\u505c<\/strong>\uff1a<strong>\u901a\u8fc7 threading.Timer \u7c7b\u3001\u4f7f\u7528 schedule \u5e93\u3001\u521b\u5efa\u81ea\u5b9a\u4e49\u7c7b<\/strong>\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5229\u7528\u8fd9\u4e9b\u65b9\u6cd5\u63a7\u5236 Python \u5b9a\u65f6\u5668\u7684\u542f\u505c\u3002<\/p>\n<\/p>\n<p><p>\u5728\u7f16\u7a0b\u4e2d\uff0c\u5b9a\u65f6\u5668\u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u8ba9\u6211\u4eec\u5728\u7279\u5b9a\u65f6\u95f4\u95f4\u9694\u540e\u6267\u884c\u67d0\u4e9b\u64cd\u4f5c\u3002Python \u63d0\u4f9b\u4e86\u591a\u79cd\u63a7\u5236\u5b9a\u65f6\u5668\u7684\u65b9\u6cd5\uff0c\u672c\u6587\u5c06\u63a2\u8ba8\u5982\u4f55\u4f7f\u7528 <code>threading.Timer<\/code> \u7c7b\u3001<code>schedule<\/code> \u5e93\u4ee5\u53ca\u81ea\u5b9a\u4e49\u7c7b\u6765\u5b9e\u73b0\u5b9a\u65f6\u5668\u7684\u542f\u52a8\u548c\u505c\u6b62\u3002<\/p>\n<\/p>\n<h2><strong>\u4e00\u3001\u901a\u8fc7 threading.Timer \u7c7b<\/strong><\/h2>\n<p><p>Python \u7684 <code>threading<\/code> \u6a21\u5757\u63d0\u4f9b\u4e86 <code>Timer<\/code> \u7c7b\uff0c\u53ef\u4ee5\u7528\u6765\u5728\u6307\u5b9a\u65f6\u95f4\u540e\u6267\u884c\u4e00\u4e2a\u51fd\u6570\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u4f7f\u7528 <code>threading.Timer<\/code> \u7c7b\u63a7\u5236\u5b9a\u65f6\u5668\u542f\u505c\u7684\u793a\u4f8b\u3002<\/p>\n<\/p>\n<p><h2>1\u3001\u521b\u5efa\u5b9a\u65f6\u5668<\/h2>\n<\/p>\n<p><p><code>threading.Timer<\/code> \u7c7b\u7684\u57fa\u672c\u7528\u6cd5\u975e\u5e38\u7b80\u5355\u3002\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5bfc\u5165 <code>threading<\/code> \u6a21\u5757\uff0c\u5e76\u521b\u5efa\u4e00\u4e2a\u5b9a\u65f6\u5668\u5bf9\u8c61\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import threading<\/p>\n<p>def hello():<\/p>\n<p>    print(&quot;Hello, World!&quot;)<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u5728 5 \u79d2\u540e\u6267\u884c hello \u51fd\u6570\u7684\u5b9a\u65f6\u5668<\/strong><\/h2>\n<p>timer = threading.Timer(5.0, hello)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>2\u3001\u542f\u52a8\u5b9a\u65f6\u5668<\/h2>\n<\/p>\n<p><p>\u8c03\u7528\u5b9a\u65f6\u5668\u5bf9\u8c61\u7684 <code>start<\/code> \u65b9\u6cd5\u53ef\u4ee5\u542f\u52a8\u5b9a\u65f6\u5668\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">timer.start()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>3\u3001\u505c\u6b62\u5b9a\u65f6\u5668<\/h2>\n<\/p>\n<p><p>\u5982\u679c\u5728\u5b9a\u65f6\u5668\u5230\u671f\u4e4b\u524d\u9700\u8981\u53d6\u6d88\u5b83\uff0c\u53ef\u4ee5\u8c03\u7528\u5b9a\u65f6\u5668\u5bf9\u8c61\u7684 <code>cancel<\/code> \u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">timer.cancel()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u793a\u4f8b\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u793a\u4f8b\u4ee3\u7801\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u521b\u5efa\u3001\u542f\u52a8\u548c\u505c\u6b62\u5b9a\u65f6\u5668\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import threading<\/p>\n<p>def hello():<\/p>\n<p>    print(&quot;Hello, World!&quot;)<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u5728 5 \u79d2\u540e\u6267\u884c hello \u51fd\u6570\u7684\u5b9a\u65f6\u5668<\/strong><\/h2>\n<p>timer = threading.Timer(5.0, hello)<\/p>\n<h2><strong>\u542f\u52a8\u5b9a\u65f6\u5668<\/strong><\/h2>\n<p>timer.start()<\/p>\n<h2><strong>\u5728 2 \u79d2\u540e\u53d6\u6d88\u5b9a\u65f6\u5668<\/strong><\/h2>\n<p>threading.Timer(2.0, timer.cancel).start()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u5b9a\u65f6\u5668\u88ab\u8bbe\u7f6e\u4e3a\u5728 5 \u79d2\u540e\u6267\u884c <code>hello<\/code> \u51fd\u6570\uff0c\u4f46\u5728 2 \u79d2\u540e\u88ab\u53d6\u6d88\uff0c\u56e0\u6b64 <code>hello<\/code> \u51fd\u6570\u4e0d\u4f1a\u88ab\u6267\u884c\u3002<\/p>\n<\/p>\n<h2><strong>\u4e8c\u3001\u4f7f\u7528 schedule \u5e93<\/strong><\/h2>\n<p><p><code>schedule<\/code> \u5e93\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684 Python \u4efb\u52a1\u8c03\u5ea6\u5e93\uff0c\u975e\u5e38\u9002\u5408\u7528\u6765\u5b9a\u65f6\u8fd0\u884c\u4efb\u52a1\u3002\u4e0e <code>threading.Timer<\/code> \u7c7b\u4e0d\u540c\uff0c<code>schedule<\/code> \u5e93\u66f4\u9002\u5408\u7528\u4e8e\u9700\u8981\u53cd\u590d\u6267\u884c\u7684\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><h2>1\u3001\u5b89\u88c5 schedule \u5e93<\/h2>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u5df2\u5b89\u88c5 <code>schedule<\/code> \u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install schedule<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>2\u3001\u521b\u5efa\u5b9a\u65f6\u4efb\u52a1<\/h2>\n<\/p>\n<p><p>\u521b\u5efa\u5b9a\u65f6\u4efb\u52a1\u975e\u5e38\u7b80\u5355\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>schedule.every<\/code> \u65b9\u6cd5\u521b\u5efa\u4efb\u52a1\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import schedule<\/p>\n<p>import time<\/p>\n<p>def job():<\/p>\n<p>    print(&quot;Hello, World!&quot;)<\/p>\n<h2><strong>\u6bcf 5 \u79d2\u6267\u884c\u4e00\u6b21 job \u51fd\u6570<\/strong><\/h2>\n<p>schedule.every(5).seconds.do(job)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>3\u3001\u8fd0\u884c\u5b9a\u65f6\u4efb\u52a1<\/h2>\n<\/p>\n<p><p>\u8981\u8fd0\u884c\u5b9a\u65f6\u4efb\u52a1\uff0c\u9700\u8981\u5728\u4e00\u4e2a\u5faa\u73af\u4e2d\u8c03\u7528 <code>schedule.run_pending<\/code> \u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">while True:<\/p>\n<p>    schedule.run_pending()<\/p>\n<p>    time.sleep(1)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u793a\u4f8b\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u793a\u4f8b\u4ee3\u7801\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528 <code>schedule<\/code> \u5e93\u521b\u5efa\u548c\u8fd0\u884c\u5b9a\u65f6\u4efb\u52a1\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import schedule<\/p>\n<p>import time<\/p>\n<p>def job():<\/p>\n<p>    print(&quot;Hello, World!&quot;)<\/p>\n<h2><strong>\u6bcf 5 \u79d2\u6267\u884c\u4e00\u6b21 job \u51fd\u6570<\/strong><\/h2>\n<p>schedule.every(5).seconds.do(job)<\/p>\n<h2><strong>\u8fd0\u884c\u5b9a\u65f6\u4efb\u52a1<\/strong><\/h2>\n<p>while True:<\/p>\n<p>    schedule.run_pending()<\/p>\n<p>    time.sleep(1)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c<code>job<\/code> \u51fd\u6570\u5c06\u6bcf\u9694 5 \u79d2\u88ab\u6267\u884c\u4e00\u6b21\u3002<\/p>\n<\/p>\n<h2><strong>\u4e09\u3001\u521b\u5efa\u81ea\u5b9a\u4e49\u7c7b<\/strong><\/h2>\n<p><p>\u9664\u4e86\u4f7f\u7528 <code>threading.Timer<\/code> \u7c7b\u548c <code>schedule<\/code> \u5e93\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u521b\u5efa\u81ea\u5b9a\u4e49\u7c7b\u6765\u5b9e\u73b0\u5b9a\u65f6\u5668\u7684\u542f\u52a8\u548c\u505c\u6b62\u3002<\/p>\n<\/p>\n<p><h2>1\u3001\u5b9a\u4e49\u81ea\u5b9a\u4e49\u5b9a\u65f6\u5668\u7c7b<\/h2>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5b9a\u4e49\u4e00\u4e2a\u81ea\u5b9a\u4e49\u5b9a\u65f6\u5668\u7c7b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import threading<\/p>\n<p>class CustomTimer:<\/p>\n<p>    def __init__(self, interval, function):<\/p>\n<p>        self.interval = interval<\/p>\n<p>        self.function = function<\/p>\n<p>        self.timer = None<\/p>\n<p>    def start(self):<\/p>\n<p>        self.timer = threading.Timer(self.interval, self.function)<\/p>\n<p>        self.timer.start()<\/p>\n<p>    def stop(self):<\/p>\n<p>        if self.timer is not None:<\/p>\n<p>            self.timer.cancel()<\/p>\n<p>            self.timer = None<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>2\u3001\u4f7f\u7528\u81ea\u5b9a\u4e49\u5b9a\u65f6\u5668\u7c7b<\/h2>\n<\/p>\n<p><p>\u521b\u5efa\u548c\u4f7f\u7528\u81ea\u5b9a\u4e49\u5b9a\u65f6\u5668\u7c7b\u975e\u5e38\u7b80\u5355\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def hello():<\/p>\n<p>    print(&quot;Hello, World!&quot;)<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u81ea\u5b9a\u4e49\u5b9a\u65f6\u5668\uff0c\u6bcf 5 \u79d2\u6267\u884c\u4e00\u6b21 hello \u51fd\u6570<\/strong><\/h2>\n<p>custom_timer = CustomTimer(5.0, hello)<\/p>\n<h2><strong>\u542f\u52a8\u5b9a\u65f6\u5668<\/strong><\/h2>\n<p>custom_timer.start()<\/p>\n<h2><strong>\u5728 2 \u79d2\u540e\u505c\u6b62\u5b9a\u65f6\u5668<\/strong><\/h2>\n<p>threading.Timer(2.0, custom_timer.stop).start()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u793a\u4f8b\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u793a\u4f8b\u4ee3\u7801\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528\u81ea\u5b9a\u4e49\u5b9a\u65f6\u5668\u7c7b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import threading<\/p>\n<p>class CustomTimer:<\/p>\n<p>    def __init__(self, interval, function):<\/p>\n<p>        self.interval = interval<\/p>\n<p>        self.function = function<\/p>\n<p>        self.timer = None<\/p>\n<p>    def start(self):<\/p>\n<p>        self.timer = threading.Timer(self.interval, self.function)<\/p>\n<p>        self.timer.start()<\/p>\n<p>    def stop(self):<\/p>\n<p>        if self.timer is not None:<\/p>\n<p>            self.timer.cancel()<\/p>\n<p>            self.timer = None<\/p>\n<p>def hello():<\/p>\n<p>    print(&quot;Hello, World!&quot;)<\/p>\n<h2><strong>\u521b\u5efa\u4e00\u4e2a\u81ea\u5b9a\u4e49\u5b9a\u65f6\u5668\uff0c\u6bcf 5 \u79d2\u6267\u884c\u4e00\u6b21 hello \u51fd\u6570<\/strong><\/h2>\n<p>custom_timer = CustomTimer(5.0, hello)<\/p>\n<h2><strong>\u542f\u52a8\u5b9a\u65f6\u5668<\/strong><\/h2>\n<p>custom_timer.start()<\/p>\n<h2><strong>\u5728 2 \u79d2\u540e\u505c\u6b62\u5b9a\u65f6\u5668<\/strong><\/h2>\n<p>threading.Timer(2.0, custom_timer.stop).start()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u81ea\u5b9a\u4e49\u5b9a\u65f6\u5668\u88ab\u8bbe\u7f6e\u4e3a\u5728 5 \u79d2\u540e\u6267\u884c <code>hello<\/code> \u51fd\u6570\uff0c\u4f46\u5728 2 \u79d2\u540e\u88ab\u53d6\u6d88\uff0c\u56e0\u6b64 <code>hello<\/code> \u51fd\u6570\u4e0d\u4f1a\u88ab\u6267\u884c\u3002<\/p>\n<\/p>\n<h2><strong>\u56db\u3001\u603b\u7ed3<\/strong><\/h2>\n<p><p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u4eec\u63a2\u8ba8\u4e86\u4e09\u79cd\u63a7\u5236 Python \u5b9a\u65f6\u5668\u542f\u505c\u7684\u65b9\u6cd5\uff1a\u4f7f\u7528 <code>threading.Timer<\/code> \u7c7b\u3001\u4f7f\u7528 <code>schedule<\/code> \u5e93\u4ee5\u53ca\u521b\u5efa\u81ea\u5b9a\u4e49\u7c7b\u3002\u8fd9\u4e9b\u65b9\u6cd5\u5404\u6709\u4f18\u7f3a\u70b9\uff0c\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u6765\u5b9e\u73b0\u5b9a\u65f6\u5668\u7684\u542f\u52a8\u548c\u505c\u6b62\u3002<\/p>\n<\/p>\n<p><p><strong>\u4f7f\u7528 <code>threading.Timer<\/code> \u7c7b<\/strong>\uff1a\u9002\u5408\u4e00\u6b21\u6027\u4efb\u52a1\uff0c\u7b80\u5355\u6613\u7528\u3002<br \/><strong>\u4f7f\u7528 <code>schedule<\/code> \u5e93<\/strong>\uff1a\u9002\u5408\u9700\u8981\u53cd\u590d\u6267\u884c\u7684\u4efb\u52a1\uff0c\u529f\u80fd\u5f3a\u5927\u3002<br \/><strong>\u521b\u5efa\u81ea\u5b9a\u4e49\u7c7b<\/strong>\uff1a\u7075\u6d3b\u6027\u9ad8\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u6c42\u81ea\u5b9a\u4e49\u5b9a\u65f6\u5668\u7684\u884c\u4e3a\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0 Python \u5b9a\u65f6\u5668\u7684\u63a7\u5236\uff0c\u6ee1\u8db3\u5404\u79cd\u4e0d\u540c\u7684\u9700\u6c42\u3002\u65e0\u8bba\u662f\u4e00\u6b21\u6027\u4efb\u52a1\u8fd8\u662f\u53cd\u590d\u6267\u884c\u7684\u4efb\u52a1\uff0c\u8fd9\u4e9b\u65b9\u6cd5\u90fd\u80fd\u63d0\u4f9b\u6709\u6548\u7684\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u5b9e\u73b0\u5b9a\u65f6\u5668\u7684\u542f\u505c\u63a7\u5236\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>threading.Timer<\/code>\u7c7b\u6765\u521b\u5efa\u4e00\u4e2a\u5b9a\u65f6\u5668\u3002\u901a\u8fc7\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\u4f5c\u4e3a\u56de\u8c03\uff0c\u53ef\u4ee5\u5728\u6307\u5b9a\u7684\u65f6\u95f4\u540e\u6267\u884c\u8be5\u51fd\u6570\u3002\u8981\u63a7\u5236\u5b9a\u65f6\u5668\u7684\u542f\u505c\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u4e00\u4e2a\u6807\u5fd7\u4f4d\u6765\u5224\u65ad\u662f\u5426\u9700\u8981\u7ee7\u7eed\u6267\u884c\uff0c\u6216\u8005\u901a\u8fc7\u8c03\u7528\u5b9a\u65f6\u5668\u7684<code>cancel()<\/code>\u65b9\u6cd5\u6765\u505c\u6b62\u5b9a\u65f6\u5668\u3002<\/p>\n<p><strong>\u5b9a\u65f6\u5668\u53ef\u4ee5\u8bbe\u7f6e\u591a\u957f\u65f6\u95f4\uff1f<\/strong><br \/>\u5728Python\u4e2d\uff0c<code>threading.Timer<\/code>\u7684\u65f6\u95f4\u53c2\u6570\u53ef\u4ee5\u8bbe\u7f6e\u4e3a\u4efb\u610f\u975e\u8d1f\u6d6e\u70b9\u6570\uff0c\u8868\u793a\u5ef6\u8fdf\u7684\u79d2\u6570\u3002\u65e0\u8bba\u662f\u77ed\u6682\u7684\u51e0\u79d2\u949f\uff0c\u8fd8\u662f\u957f\u65f6\u95f4\u7684\u51e0\u5c0f\u65f6\uff0c\u90fd\u53ef\u4ee5\u6839\u636e\u9700\u8981\u8fdb\u884c\u8c03\u6574\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5b9a\u65f6\u5668\u7684\u65f6\u95f4\u7cbe\u5ea6\u53d7\u7cfb\u7edf\u8c03\u5ea6\u7684\u5f71\u54cd\uff0c\u53ef\u80fd\u4f1a\u6709\u8f7b\u5fae\u5ef6\u8fdf\u3002<\/p>\n<p><strong>\u5982\u679c\u5b9a\u65f6\u5668\u6267\u884c\u7684\u4efb\u52a1\u9700\u8981\u4f20\u9012\u53c2\u6570\uff0c\u8be5\u5982\u4f55\u5904\u7406\uff1f<\/strong><br \/>\u5728\u4f7f\u7528<code>threading.Timer<\/code>\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7<code>args<\/code>\u53c2\u6570\u6765\u4f20\u9012\u4efb\u52a1\u6240\u9700\u7684\u53c2\u6570\u3002\u8be5\u53c2\u6570\u5e94\u8be5\u662f\u4e00\u4e2a\u5143\u7ec4\uff0c\u5305\u542b\u6240\u6709\u9700\u8981\u4f20\u9012\u7ed9\u56de\u8c03\u51fd\u6570\u7684\u53c2\u6570\u3002\u8fd9\u6837\uff0c\u5728\u5b9a\u65f6\u5668\u5230\u8fbe\u8bbe\u5b9a\u65f6\u95f4\u540e\uff0c\u56de\u8c03\u51fd\u6570\u5c06\u80fd\u591f\u63a5\u6536\u5230\u8fd9\u4e9b\u53c2\u6570\u5e76\u8fdb\u884c\u76f8\u5e94\u7684\u5904\u7406\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u5b9a\u65f6\u5668\u5982\u4f55\u63a7\u5236\u542f\u505c\uff1a\u901a\u8fc7 threading.Timer \u7c7b\u3001\u4f7f\u7528 schedule \u5e93\u3001\u521b\u5efa\u81ea\u5b9a [&hellip;]","protected":false},"author":3,"featured_media":1091349,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1091337"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1091337"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1091337\/revisions"}],"predecessor-version":[{"id":1091350,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1091337\/revisions\/1091350"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1091349"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1091337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1091337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1091337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}