{"id":203,"date":"2019-04-05T01:53:01","date_gmt":"2019-04-04T17:53:01","guid":{"rendered":"http:\/\/www.buyige.net\/?p=203"},"modified":"2020-05-20T01:35:43","modified_gmt":"2020-05-19T17:35:43","slug":"%e4%bd%bf%e7%94%a8python%e6%8a%93%e5%8f%96%e8%af%84%e4%b9%a6%e7%bd%91%e7%ab%99%e7%9a%84%e5%b0%8f%e8%af%b4%e8%af%84%e4%b9%a6","status":"publish","type":"post","link":"https:\/\/www.buyige.net\/?p=203","title":{"rendered":"\u4f7f\u7528Python\u6293\u53d6\u8bc4\u4e66\u7f51\u7ad9\u7684\u5c0f\u8bf4\u8bc4\u4e66"},"content":{"rendered":"\n<p>\u542c\u8bc4\u4e66\u8fd9\u79cd\u4e1c\u897f\u771f\u7684\u662f\u4e0a\u763e\uff01\u5f00\u59cb\u53ea\u662f\u4e0a\u4e0b\u73ed\u8def\u4e0a\u542c\uff0c\u540e\u6765\u5728\u5355\u4f4d\u4e0a\u73ed\uff0c\u4e5f\u4e60\u60ef\u5e26\u7740\u8033\u673a\u542c\uff0c\u8fd9\u6837\u53ef\u4ee5\u5c4f\u853d\u6389\u5916\u754c\u7684\u5e72\u6270\uff0c\u5e72\u6d3b\u7684\u6548\u7387\u76f8\u5bf9\u8981\u9ad8\u4e00\u4e9b\u3002<\/p>\n\n\n\n<p>\u6700\u8fd1\u66f4\u662f\u4e0a\u763e\u4e86\uff0c\u542c\u4e00\u4e2a\u5c0f\u8bf4\uff0c\u7528\u7684\u662fapp\u5728\u7ebf\u542c\u7684\uff0c\u4f46\u662f\u73b0\u5728\u7684app\u5565\u90fd\u60f3\u8981\u5f00\u4e00\u4e2aVIP\uff0c\u7b80\u76f4\u4e86\u3002\u3002\u3002\u7a77\u4eba\u5462\u603b\u6709\u81ea\u5df1\u7684\u8def\u5b50\uff0c\u4e8e\u662f\u6211\u5c31\u60f3\u7740\u81ea\u5df1\u7535\u8111\u4e0b\u8f7d\u597d\uff0c\u7136\u540e\u5728\u4f20\u5230\u624b\u673a\u91cc\u3002\u8fd9\u91cc\u5c31\u8981\u8bf4\u4e00\u4e0b\u73b0\u5728\u7684\u8bc4\u4e66\u7f51\u7ad9\uff0c\u6709\u7684\u4e5f\u662f\u9700\u8981vip\uff0c\u6709\u7684\u5c31\u662f\u4e71\u4e03\u516b\u7cdf\u7684\u6295\u5404\u79cd\u5783\u573e\u5e7f\u544a\uff0c\u53ea\u80fd\u8bf4\u4f53\u9a8c\u6781\u5dee\u3002<\/p>\n\n\n\n<p>\u56de\u60f3\u4e24\u5e74\u524d\u4e5f\u662f\u505a\u8fc7\u7c7b\u4f3c\u7684\u662f\uff0c\u5f53\u65f6\u5c31\u662f\u7528\u4e00\u4e2aExcel\u6587\u4ef6\uff0c\u624b\u52a8\u627e\u5230\u89c4\u5f8b\uff0c\u7136\u540e\u4f9d\u8d56Excel\u7684\u7f16\u8f91\u586b\u5145\u529f\u80fd\u53bb\u5b9e\u73b0\u4e00\u4e9b\u7f51\u5740\u7684\u6574\u7406\uff0c\u7136\u540e\u518d\u7edf\u4e00\u5efa\u7acb\u8fc5\u96f7\u6279\u91cf\u4efb\u52a1\u4e0b\u8f7d\u3002\u4f46\u662f\u8fd9\u4e2a\u65b9\u6cd5\u5728\u73b0\u5728\u5df2\u7ecf\u884c\u4e0d\u901a\u4e86\u3002\u73b0\u5728\u7684\u7f51\u7ad9\u7684\u4e0b\u8f7d\u653e\u76d7\u94fe\u624b\u6bb5\u8fd8\u662f\u6bd4\u8f83\u591a\u7684\uff0c\u9700\u8981\u7f51\u9875\u7684\u4ea4\u4e92\uff0c\u94fe\u63a5\u4e5f\u6709\u65f6\u95f4\u9650\u5236\uff0c\u539f\u6765\u7684\u65b9\u6cd5\u663e\u7136\u5df2\u7ecf\u884c\u4e0d\u901a\u4e86\u3002\u4e8e\u662f\u53ea\u6709\u53e6\u8f9f\u8e4a\u5f84\u4e86\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"336\" height=\"377\" src=\"http:\/\/www.buyige.net\/wp-content\/uploads\/2019\/04\/u20090884753376351105fm26gp0-1.jpg\" alt=\"\" class=\"wp-image-204\" srcset=\"https:\/\/www.buyige.net\/wp-content\/uploads\/2019\/04\/u20090884753376351105fm26gp0-1.jpg 336w, https:\/\/www.buyige.net\/wp-content\/uploads\/2019\/04\/u20090884753376351105fm26gp0-1-267x300.jpg 267w\" sizes=\"auto, (max-width: 336px) 100vw, 336px\" \/><\/figure>\n\n\n\n<p>\u8fd9\u91cc\u6211\u5c31\u628a\u773c\u5149\u653e\u5230\u4e86Python\u4e0a\u4e86\uff0c\u867d\u7136\u6211\u4e2a\u4eba\u4f1a\u7684\u8bed\u8a00\u662fcpp\uff0c\u4f46\u662f\u592a\u7b28\u91cd\u4e86\uff0c\u505a\u8fd9\u79cd\u4e0d\u592a\u5408\u9002\uff0c\u867d\u7136\u6211\u786e\u4fe1\u53ef\u4ee5\u5b9e\u73b0\uff0c\u4f46\u662f\u6ca1\u5fc5\u8981\u3002\u671f\u95f4\u4e5f\u54a8\u8be2\u8bf7\u6559\u4e86\u597d\u51e0\u4e2a\u5927\u725b\uff0c\u4f46\u662f\u53ef\u80fd\u662f\u6211\u8bed\u6587\u8868\u8fbe\u80fd\u529b\u4e0d\u884c\uff0c\u5927\u725b\u53ea\u8868\u793a\u4e86\u7231\u83ab\u80fd\u52a9\uff0c\u6240\u4ee5\u6211\u53ea\u80fd\u81ea\u5df1\u52a8\u624b\uff0c\u4e30\u8863\u8db3\u98df\u4e86\u3002\u9996\u5148\u6211\u4eec\u5148\u770b\u770b\u8fc5\u96f7\u4e0b\u8f7d\u754c\u9762\uff08\u8fd9\u4e2a\u540e\u52a0\u768425\u662f\u56e0\u4e3a\u811a\u672c\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u6211\u5728\u5fd9\u522b\u7684\u4e8b\uff0c\u70ed\u70b9\u5207\u5165\u5230\u4e86\u811a\u672c\u8c03\u7528\u7684\u6d4f\u89c8\u5668\u4e2d\uff0c\u8bef\u64cd\u4f5c\u5bfc\u81f4\u6f0f\u4e86\u4e00\u56de\uff0c\u540e\u6765\u624b\u52a8\u7ed9\u8865\u4e0a\uff09<\/p>\n\n\n\n<p>\u8fd9\u4e9b\u90fd\u5f88\u5bb9\u6613\u5b9e\u73b0\uff0c\u6211\u4e00\u4e2a\u6ca1\u7528\u8fc7Python\u7684\u51e0\u4e2a\u5c0f\u65f6\u7684\u767e\u5ea6\u6210\u672c\u52a0\u5206\u6790\u6210\u672c\u5c31\u5199\u4e86\u4e00\u4e2a\u5c0f\u811a\u672c\u6a21\u677f\uff0c\u5df2\u7ecf\u53ef\u4ee5\u6b63\u5e38\u89e3\u6790\u4e00\u4e2a\u7f51\u7ad9\u7684\u94fe\u63a5\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from selenium import webdriver\nfrom time import sleep\nfrom win32com.client import Dispatch\n\nchrome_driver = 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chromedriver.exe'\ndriver = webdriver.Chrome(executable_path= chrome_driver)\ndriver.implicitly_wait(5)\nfile1 = open('links.txt', 'a')\n\n#\u66ff\u6362\u8fd9\u91cc\nl = range(43521,43563)\nserialName = \"G:\\\\\u8fc5\u96f7\u4e0b\u8f7d\\\\\u8bc4\u4e66\\\\\u767d\u9e7f\u539f\"\n####\nfor x in l:\n    driver.get(url=\"http:\/\/www.pingshu8.com\/down_%s.html\" %x)\n    titliename = driver.title\n    driver.find_element_by_id('clickina').click()\n    sleep(2)\n    allHandles = driver.window_handles;\n    driver.switch_to.window(allHandles[len(allHandles)-1])\n    print(allHandles)\n    print(titliename)\n    addstr = driver.current_url\n    thunder = Dispatch('ThunderAgent.Agent.1')\n    thunder.AddTask(addstr, titliename, serialName)\n    thunder.CommitTasks()\n    print(addstr)\n    file1.write(addstr)\n    file1.write('n')\n    m = range(1, len(allHandles) - 1)\n\n    for y in m:\n        print(allHandles[y])\n        driver.switch_to.window(allHandles[y])\n        sleep(2)\n        driver.close()\n        driver.switch_to.window(allHandles[0])\n        print(\"close\")\nfile1.close<\/code><\/pre>\n\n\n\n<p>\u61c2\u7684\u4eba\u81ea\u7136\u61c2\u4e86\uff0c\u4e0d\u61c2\u7684\u5c31\u4ea4vip\u633a\u597d\u3002\u611f\u5174\u8da3\u7684\u53ef\u4ee5\u642d\u4e00\u4e2aPython\u5f00\u53d1\u73af\u5883\uff0c\u628a\u4e0a\u9762\u7684\u4e00\u6bb5\u590d\u5236\u4e0a\u53bb\u770b\u770b\u8fd0\u884c\u7684\u7ed3\u679c\u662f\u4ec0\u4e48\u6837\u7684\uff0c\u8fd9\u91cc\u8fd8\u6709\u51e0\u4e2a\u5c0f\u6280\u5de7\u6211\u6ca1\u6709\u660e\u786e\u70b9\u51fa\u6765\uff0c\u4f46\u662f\u90fd\u5e94\u8be5\u662f\u80fd\u767e\u5ea6\u5230\u771f\u786e\u7684\u7b54\u6848\u7684\u3002\u8bf4\u5b9e\u8bdd\uff0c\u767e\u5ea6\u771f\u7684\u633a\u597d\u7684\uff0c\u4e0d\u4f46\u80fd\u627e\u5230\u5408\u9002\u7684\u7b54\u6848\uff0c\u8fd8\u7ec3\u5c31\u4e86\u6211\u4e00\u53cc\u706b\u773c\u91d1\u775b\u3002\u8c37\u6b4c\u4e0d\u884c\uff0c\u4e00\u822c\u7b2c\u4e00\u6761\u5c31\u662f\u4f60\u60f3\u8981\u7684\uff0c\u5176\u4ed6\u7684\u90fd\u7d22\u7136\u65e0\u5473\uff0c\u597d\u65e0\u8da3\u3002<\/p>\n\n\n\n<p>\u6211\u662f\u7528eclipse\u5f00\u53d1\u7684\uff0c\u4ee5\u524d\u6ca1\u6709\u7528\u8fc7\u3002\u6211\u662f\u8bf4eclipse\u548cPython\u90fd\u6ca1\u6709\u7528\u8fc7\u3002\u5f00\u53d1\u7684\u754c\u9762\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"1040\" src=\"http:\/\/www.buyige.net\/wp-content\/uploads\/2019\/04\/QQ\u622a\u56fe20190405014812.png\" alt=\"\" class=\"wp-image-206\" srcset=\"https:\/\/www.buyige.net\/wp-content\/uploads\/2019\/04\/QQ\u622a\u56fe20190405014812.png 1280w, https:\/\/www.buyige.net\/wp-content\/uploads\/2019\/04\/QQ\u622a\u56fe20190405014812-300x244.png 300w, https:\/\/www.buyige.net\/wp-content\/uploads\/2019\/04\/QQ\u622a\u56fe20190405014812-768x624.png 768w, https:\/\/www.buyige.net\/wp-content\/uploads\/2019\/04\/QQ\u622a\u56fe20190405014812-1024x832.png 1024w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/figure>\n\n\n\n<p>\u8fd0\u884c\u8d77\u6765\u4ee5\u540e\u662f\u8fd9\u6837\uff0c\u6ce8\u610f\u4f1a\u63d0\u793a\uff1a\u201cChrome \u6b63\u53d7\u5230\u81ea\u52a8\u6d4b\u8bd5\u8f6f\u4ef6\u7684\u63a7\u5236\u201d<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1275\" height=\"1020\" src=\"http:\/\/www.buyige.net\/wp-content\/uploads\/2019\/04\/QQ\u622a\u56fe20190405015006.png\" alt=\"\" class=\"wp-image-207\" srcset=\"https:\/\/www.buyige.net\/wp-content\/uploads\/2019\/04\/QQ\u622a\u56fe20190405015006.png 1275w, https:\/\/www.buyige.net\/wp-content\/uploads\/2019\/04\/QQ\u622a\u56fe20190405015006-300x240.png 300w, https:\/\/www.buyige.net\/wp-content\/uploads\/2019\/04\/QQ\u622a\u56fe20190405015006-768x614.png 768w, https:\/\/www.buyige.net\/wp-content\/uploads\/2019\/04\/QQ\u622a\u56fe20190405015006-1024x819.png 1024w\" sizes=\"auto, (max-width: 1275px) 100vw, 1275px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u542c\u8bc4\u4e66\u8fd9\u79cd\u4e1c\u897f\u771f\u7684\u662f\u4e0a\u763e\uff01\u5f00\u59cb\u53ea\u662f\u4e0a\u4e0b\u73ed\u8def\u4e0a\u542c\uff0c\u540e\u6765\u5728\u5355\u4f4d\u4e0a\u73ed\uff0c\u4e5f\u4e60\u60ef\u5e26\u7740\u8033\u673a\u542c\uff0c\u8fd9\u6837\u53ef\u4ee5\u5c4f\u853d\u6389\u5916\u754c\u7684\u5e72\u6270\uff0c\u5e72 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-203","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.buyige.net\/index.php?rest_route=\/wp\/v2\/posts\/203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.buyige.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.buyige.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.buyige.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.buyige.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=203"}],"version-history":[{"count":5,"href":"https:\/\/www.buyige.net\/index.php?rest_route=\/wp\/v2\/posts\/203\/revisions"}],"predecessor-version":[{"id":353,"href":"https:\/\/www.buyige.net\/index.php?rest_route=\/wp\/v2\/posts\/203\/revisions\/353"}],"wp:attachment":[{"href":"https:\/\/www.buyige.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.buyige.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.buyige.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}