{"id":1267,"date":"2019-07-13T16:33:48","date_gmt":"2019-07-13T07:33:48","guid":{"rendered":"http:\/\/int-info.com\/?page_id=1267"},"modified":"2019-07-13T16:40:28","modified_gmt":"2019-07-13T07:40:28","slug":"tips02","status":"publish","type":"page","link":"http:\/\/int-info.com\/index.php\/tips02\/","title":{"rendered":"\u30b9\u30b1\u30b8\u30e5\u30fc\u30e9"},"content":{"rendered":"<p>5\u79d2\u306b1\u5ea6\u3042\u308b\u7279\u5b9a\u306e\u30b8\u30e7\u30d6\u3092\u884c\u3044\u7d9a\u3051\u308b\u3001\u3068\u3044\u3063\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u73fe\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002pip3 install schedule\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304b\u3089\u4f7f\u3044\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"lang:default decode:true \" title=\"test.py\" >\r\n\r\nimport schedule\r\n\r\n# \u5b9a\u671f\u7684\u306b\u5b9f\u884c\u3059\u308b\u30b8\u30e7\u30d6\u3092\u5b9a\u7fa9\r\ndef add2(x, y):\r\n    print(x+y)\r\n\r\nif __name__ == \"__main__\":\r\n\r\n    # \u30b8\u30e7\u30d6\u306e\u5b9f\u884c\u9593\u9694\u3092\u767b\u9332\r\n    schedule.every(5).seconds.do(add2, 1, 2)\r\n\r\n    # \u30b9\u30bf\u30fc\u30c8\r\n    while True:\r\n        schedule.run_pending() # &lt;- \u767b\u9332\u3057\u305f\u30b8\u30e7\u30d6\u3092\u5b9f\u884c\u3059\u308b\r\n        time.sleep(1)<\/pre>\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u3067\u306f\u30015\u79d2\u306b1\u56de\u3001add2\u95a2\u6570\u3067\u5b9a\u7fa9\u3055\u308c\u305f\u6a5f\u80fd\u3092\u5b9f\u884c\u3057\u7d9a\u3051\u307e\u3059\u3002do\u95a2\u6570\u306e\u4e2d\u3067\u3001add2, 1, 2\u3068\u5f15\u6570\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001add2\u95a2\u6570\u306b1\u30682\u3092\u6e21\u3057\u305f\u3068\u304d\u6a5f\u80fd\u306e\u5b9f\u65bd\u304c\u767b\u9332\u3055\u308c\u307e\u3059\u3002\u6700\u5f8c\u306b\u3001run_pending\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u767b\u9332\u3055\u308c\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u30b8\u30e7\u30d6\u304c\u5b9f\u884c\u3055\u308c\u7d9a\u3051\u307e\u3059\u3002<\/p>\n<p>\u4ed6\u306b\u3082\u3001\u5348\u524d10\u6642\u306b\u5b9f\u884c\u3001\u3068\u3044\u3063\u305f\u767b\u9332\u306e\u4ed5\u65b9\u3082\u3067\u304d\u307e\u3059\u3002\u8a73\u3057\u304f\u306fweb\u3067\u63a2\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>5\u79d2\u306b1\u5ea6\u3042\u308b\u7279\u5b9a\u306e\u30b8\u30e7\u30d6\u3092\u884c\u3044\u7d9a\u3051\u308b\u3001\u3068\u3044\u3063\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u73fe\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002pip3 install schedule\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304b\u3089\u4f7f\u3044\u307e\u3057\u3087\u3046\u3002 import schedule # \u5b9a\u671f\u7684\u306b\u5b9f\u884c\u3059\u308b\u30b8\u30e7\u30d6\u3092\u5b9a<\/p><\/div>\n<div class=\"blog-btn\"><a href=\"http:\/\/int-info.com\/index.php\/tips02\/\" class=\"home-blog-btn\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1267","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/pages\/1267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/comments?post=1267"}],"version-history":[{"count":3,"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/pages\/1267\/revisions"}],"predecessor-version":[{"id":1270,"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/pages\/1267\/revisions\/1270"}],"wp:attachment":[{"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/media?parent=1267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}