{"id":2883,"date":"2023-12-11T21:38:26","date_gmt":"2023-12-11T13:38:26","guid":{"rendered":"https:\/\/www.tra56.com\/?p=2883"},"modified":"2023-12-11T21:40:07","modified_gmt":"2023-12-11T13:40:07","slug":"2883","status":"publish","type":"post","link":"https:\/\/www.tra56.com\/2883.html","title":{"rendered":"python\u5236\u4f5c\u5b9a\u65f6\u53d1\u9001\u4fe1\u606f\u811a\u672c"},"content":{"rendered":"
<\/p>\n
\u6211\u4eec\u9700\u8981\u505a\u5230\u6253\u5f00\u5fae\u4fe1\u83b7\u53d6\u8f93\u5165\u6846\u7126\u70b9\u53ca\u8f93\u5165<\/p>\n
1\uff0c\u83b7\u53d6\u5230\u53f3\u4e0b\u89d2\u83dc\u5355\u7684\u5750\u6807\u548c\u83dc\u5355\u4e2d\u5fae\u4fe1\u7684\u5750\u6807\u4ee5\u53ca\u8f93\u5165\u6846\u7684\u5750\u6807<\/p>\n
2\uff0c\u5b9a\u65f6\uff0c\u7528time.sleep()\u6765\u5b9a\u4e49\u591a\u957f\u65f6\u95f4\u540e\u89e6\u53d1<\/p>\n
2\uff0c\u542f\u52a8\u70b9\u51fb\u4e8b\u4ef6\u4ee5\u83b7\u5f97\u7126\u70b9<\/p>\n
3\uff0c\u5c06\u6587\u672c\u590d\u5236\u5230\u8f93\u5165\u6846\uff0c\u53d1\u9001<\/p>\n
import os\r\nimport time\r\n\r\nimport pyautogui\r\n\r\ntry:\r\n while True:\r\n x, y = pyautogui.position()\r\n posStr = "Position:" + str(x).rjust(4) + ',' + str(y).rjust(4)\r\n print(posStr)\r\n time.sleep(0.2)\r\n os.system('cls') \r\nexcept KeyboardInterrupt:\r\n print('end....')<\/pre>\n\u4e0a\u8ff0\u4ee3\u7801\u4f1a\u8bb0\u5f55\u9f20\u6807\u79fb\u52a8\u7684\u5750\u6807\uff0c\u53ea\u9700\u8981\u5c06\u9f20\u6807\u505c\u5230\u5bf9\u5e94\u4f4d\u7f6e\u8bb0\u5f55\u4e0b\u5750\u6807\u5373\u53ef<\/p>\n
<\/a>2\uff0c\u5b9a\u65f6<\/h4>\n
\u4e00\u4e2atime.sleep()\u5c31\u884c\u65f6\u95f4\u957f\u77ed\u81ea\u5df1\u628a\u63e1<\/p>\n
<\/a>3\uff0c\u83b7\u53d6\u7126\u70b9<\/h4>\n
pyautogui.click(1647, 1056)#\u70b9\u51fb\u83dc\u5355\r\ntime.sleep(0.2)\r\npyautogui.click(1633, 981)#\u70b9\u51fb\u5fae\u4fe1\u56fe\u6807\r\ntime.sleep(0.2)\r\npyautogui.click(871, 760)#\u70b9\u51fb\u8f93\u5165\u6846\u83b7\u53d6\u5230\u7126\u70b9<\/pre>\n4\uff0c\u53d1\u9001\u4fe1\u606f<\/h4>\n
with open("D:\/UserData\/Desktop\/\u56de\u7b54.txt", 'r', encoding='utf-8') as f:\r\n content = f.read()\r\ntime.sleep(3)\r\npyautogui.click(1647, 1056)\r\ntime.sleep(0.2)\r\npyautogui.click(1633, 981)\r\ntime.sleep(0.2)\r\nfor line in list(content.split("\\n")):\r\n if line:\r\n pyautogui.click(871, 760) # \u83dc\u5355\u5750\u68071647 1056 \u5fae\u4fe1\u5750\u68071633 981 \u804a\u5929\u7a97\u53e3\u5750\u6807962 605\r\n pyperclip.copy(line) # \u590d\u5236\u8be5\u884c\r\n pyautogui.hotkey("ctrl", "v") # \u7c98\u8d34\r\n pyautogui.typewrite("\\n") # \u53d1\u9001\r\n time.sleep(3) # \u6bcf\u6b21\u53d1\u5b8c\u95f4\u9694\u65f6\u95f4<\/pre>\n\u300a\u56de\u7b54\u300b<\/h2>\n
\u5351\u9119\u662f\u5351\u9119\u8005\u7684\u901a\u884c\u8bc1\uff0c<\/p>\n
\u9ad8\u5c1a\u662f\u9ad8\u5c1a\u8005\u7684\u5893\u5fd7\u94ed\uff0c<\/p>\n
\u770b\u5427\uff0c\u5728\u90a3\u9540\u91d1\u7684\u5929\u7a7a\u4e2d\uff0c<\/p>\n
\u98d8\u6ee1\u4e86\u6b7b\u8005\u5f2f\u66f2\u7684\u5012\u5f71\u3002<\/p>\n
\u51b0\u5ddd\u7eaa\u8fc7\u53bb\u4e86\uff0c<\/p>\n
\u4e3a\u4ec0\u4e48\u5230\u5904\u90fd\u662f\u51b0\u51cc\uff1f<\/p>\n
\u597d\u671b\u89d2\u53d1\u73b0\u4e86\uff0c<\/p>\n
\u4e3a\u4ec0\u4e48\u6b7b\u6d77\u91cc\u5343\u5e06\u76f8\u7ade\uff1f<\/p>\n
\u6211\u6765\u5230\u8fd9\u4e2a\u4e16\u754c\u4e0a\uff0c<\/p>\n
\u53ea\u5e26\u7740\u7eb8\u3001\u7ef3\u7d22\u548c\u8eab\u5f71\uff0c<\/p>\n
\u4e3a\u4e86\u5728\u5ba1\u5224\u524d\uff0c<\/p>\n
\u5ba3\u8bfb\u90a3\u4e9b\u88ab\u5224\u51b3\u7684\u58f0\u97f3\u3002<\/p>\n
\u544a\u8bc9\u4f60\u5427\uff0c\u4e16\u754c<\/p>\n
\u6211\u2014\u2014\u4e0d\u2014\u2014\u76f8\u2014\u2014\u4fe1\uff01<\/p>\n
\u7eb5\u4f7f\u4f60\u811a\u4e0b\u6709\u4e00\u5343\u540d\u6311\u6218\u8005\uff0c<\/p>\n
\u90a3\u5c31\u628a\u6211\u7b97\u4f5c\u7b2c\u4e00\u5343\u96f6\u4e00\u540d\u3002<\/p>\n
\u6211\u4e0d\u76f8\u4fe1\u5929\u662f\u84dd\u7684\uff0c<\/p>\n
\u6211\u4e0d\u76f8\u4fe1\u96f7\u7684\u56de\u58f0\uff0c<\/p>\n
\u6211\u4e0d\u76f8\u4fe1\u68a6\u662f\u5047\u7684\uff0c<\/p>\n
\u6211\u4e0d\u76f8\u4fe1\u6b7b\u65e0\u62a5\u5e94\u3002<\/p>\n
\u5982\u679c\u6d77\u6d0b\u6ce8\u5b9a\u8981\u51b3\u5824\uff0c<\/p>\n
\u5c31\u8ba9\u6240\u6709\u7684\u82e6\u6c34\u90fd\u6ce8\u5165\u6211\u5fc3\u4e2d\uff0c<\/p>\n
\u5982\u679c\u9646\u5730\u6ce8\u5b9a\u8981\u4e0a\u5347\uff0c<\/p>\n
\u5c31\u8ba9\u4eba\u7c7b\u91cd\u65b0\u9009\u62e9\u751f\u5b58\u7684\u5cf0\u9876\u3002<\/p>\n
\u65b0\u7684\u8f6c\u673a\u548c\u95ea\u95ea\u661f\u6597\uff0c<\/p>\n
\u6b63\u5728\u7f00\u6ee1\u6ca1\u6709\u906e\u62e6\u7684\u5929\u7a7a\u3002<\/p>\n
\u90a3\u662f\u4e94\u5343\u5e74\u7684\u8c61\u5f62\u6587\u5b57\uff0c<\/p>\n
\u90a3\u662f\u672a\u6765\u4eba\u4eec\u51dd\u89c6\u7684\u773c\u775b\u3002<\/p>\n
<\/p>\n","protected":false},"excerpt":{"rendered":"
\u9700\u6c42 \u6211\u4eec\u9700\u8981\u505a\u5230\u6253\u5f00\u5fae\u4fe1\u83b7\u53d6\u8f93\u5165\u6846\u7126\u70b9\u53ca\u8f93\u5165 \u601d\u8def 1\uff0c\u83b7\u53d6\u5230\u53f3\u4e0b\u89d2\u83dc\u5355\u7684\u5750\u6807\u548c\u83dc\u5355\u4e2d\u5fae\u4fe1\u7684\u5750\u6807\u4ee5\u53ca\u8f93\u5165\u6846\u7684 […]<\/p>\n","protected":false},"author":1,"featured_media":2884,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-2883","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python3"],"_links":{"self":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/2883"}],"collection":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/comments?post=2883"}],"version-history":[{"count":2,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/2883\/revisions"}],"predecessor-version":[{"id":2886,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/posts\/2883\/revisions\/2886"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/media\/2884"}],"wp:attachment":[{"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/media?parent=2883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/categories?post=2883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tra56.com\/wp-json\/wp\/v2\/tags?post=2883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}