{"id":989,"date":"2023-02-03T15:49:48","date_gmt":"2023-02-03T07:49:48","guid":{"rendered":"https:\/\/log.tanxiaodian.com\/?p=989"},"modified":"2023-02-03T15:50:40","modified_gmt":"2023-02-03T07:50:40","slug":"python%e5%86%99%e7%9a%84%e4%b8%80%e4%b8%aa%e4%bf%9d%e6%8a%a4%e7%9c%bc%e7%9d%9b%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"https:\/\/log.tanxiaodian.com\/?p=989","title":{"rendered":"Python\u5199\u7684\u4e00\u4e2a\u4fdd\u62a4\u773c\u775b\u7a0b\u5e8f"},"content":{"rendered":"\n<p>\u60a8\u662f\u5426\u6709\u65f6\u5019\u5199\u4ee3\u7801\u6216\u8005\u5de5\u4f5c\u7684\u65f6\u5019\u5fd8\u8bb0\u4e86\u4f11\u606f\uff1f\u8ba9\u5b83\u63d0\u9192\u60a8\u4f11\u606f\u5427  (\u5f3a\u5236\u9501\u5c4f\u54e6)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from ctypes import *\r\nimport time\r\nimport math\r\nimport sys\r\n\r\n\r\nrest_tm = 0\r\nsel_unit = 1\r\n\r\nd_sel = {\"1\": \"\u5206\u949f\", \"2\": \"\u5c0f\u65f6\"}\r\nsel_unit = input(\r\n\"\u8bf7\u9009\u62e9\u65f6\u95f4\u9694\u65f6\u95f4\u7c7b\u578b\uff1a\\n\" \"1\uff1a\u5206\u949f\" \"2\uff1a\u5c0f\u65f6\\n\"\r\n)\r\n\r\nif sel_unit not in d_sel:\r\n    print(\"\u8f93\u5165\u4e0d\u6b63\u786e\\n\");\r\n    sys.exit()\r\n\r\nwork_tm = int(input(\"\u8bf7\u8f93\u5165\u5de5\u4f5c\u65f6\u95f4\\n\"))\r\nrest_tm = int(input(\"\u8bf7\u8f93\u5165\u4f11\u606f\u65f6\u95f4\\n\"))\r\nprint(\"\u60a8\u7684\u7535\u8111\u5c06\u5728\", work_tm , d_sel&#91;sel_unit], \"\u540e\u9501\u5b9a\\n\")\r\n\r\nsecond_work_tm = int(math.pow(60 ,int(sel_unit)) * work_tm)   ###\u5de5\u4f5c\u65f6\u95f4\u603b\u79d2\u6570\r\ndo_second_work_tm = second_work_tm\r\n\r\nsecond_tm = int(math.pow(60 ,int(sel_unit)) * rest_tm)   ###\u4f11\u606f\u65f6\u95f4\u603b\u79d2\u6570\r\n\r\nwhile True:\r\n    while do_second_work_tm > 0:\r\n        do_second_work_tm -= 1\r\n        time.sleep(1)\r\n        if do_second_work_tm &lt; 30 :\r\n            print(\"\u4f11\u606f\u65f6\u95f4\u8fd8\u6709\", do_second_work_tm , \"\u79d2\u5c31\u5230\u4e86\\n\")\r\n\r\n    ##\u95f4\u9694\u65f6\u95f4\u5230\r\n    do_second_work_tm = second_work_tm\r\n    sel_opt = int(input(\"\u8bf7\u9009\u62e9\u60a8\u7684\u64cd\u4f5c 1:\u7acb\u5373\u4f11\u606f  2:\u4e0b\u6b21\u4f11\u606f  3:\u9000\u51fa\u7a0b\u5e8f\\n\"))\r\n    if sel_opt not in &#91;1 , 2 , 3]:\r\n        print(\"\u8f93\u5165\u5f02\u5e38\")\r\n        sys.exit()\r\n    if sel_opt == 1:\r\n        print(\"\u7acb\u5373\u4f11\u606f,\u6211\u4f1a\u4e3a\u60a8\u9501\u5b9a\u5c4f\u5e55 \u5c4a\u65f6\u60a8\u4e0d\u80fd\u8fdb\u884c\u4efb\u4f55\u64cd\u4f5c\\n\")\r\n\r\n        #\u9501\u5b9a\u5c4f\u5e55\r\n<strong>        windll.user32.BlockInput(\"true\")\r\n        windll.user32.SetCursorPos(100, 100)  <\/strong>\r\n\r\n        #\u4f11\u606f\u4f11\u606f===========================\r\n        while second_tm > 0:\r\n            second_tm -= 1\r\n            time.sleep(1)\r\n            if second_tm &lt; 60:\r\n                print(\"\u8fd8\u6709\", second_tm , \"\u79d2\u56de\u5230\u5de5\u4f5c\\n\")\r\n\r\n        #\u91ca\u653e\u5c4f\u5e55\r\n        <strong>windll.user32.BlockInput(0)<\/strong>\r\n        print(\"\u56de\u5230\u5de5\u4f5c\u72b6\u6001 \u5f00\u5fc3\u5de5\u4f5c\u5427\\n\")\r\n    if sel_opt == 2:\r\n        print(\"\u60a8\u9009\u62e9\u4e86\u4e0b\u6b21\u4f11\u606f,\u773c\u775b\u65f6\u5fc3\u7075\u7684\u7a97\u6237\u8981\u4fdd\u62a4\u597d\u54e6\\n\")\r\n        continue\r\n    if sel_opt == 3:\r\n        sys.exit()<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u60a8\u662f\u5426\u6709\u65f6\u5019\u5199\u4ee3\u7801\u6216\u8005\u5de5\u4f5c\u7684\u65f6\u5019\u5fd8\u8bb0\u4e86\u4f11\u606f\uff1f\u8ba9\u5b83\u63d0&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/log.tanxiaodian.com\/?p=989\">Continue reading<span class=\"screen-reader-text\">Python\u5199\u7684\u4e00\u4e2a\u4fdd\u62a4\u773c\u775b\u7a0b\u5e8f<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[182,12],"tags":[190],"_links":{"self":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/989"}],"collection":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=989"}],"version-history":[{"count":1,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/989\/revisions"}],"predecessor-version":[{"id":990,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/989\/revisions\/990"}],"wp:attachment":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=989"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=989"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=989"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}