{"id":204078,"date":"2025-05-29T13:31:49","date_gmt":"2025-05-29T05:31:49","guid":{"rendered":"https:\/\/server.hk\/cnblog\/204078\/"},"modified":"2025-05-29T13:31:49","modified_gmt":"2025-05-29T05:31:49","slug":"%e5%a6%82%e4%bd%95%e7%b2%be%e7%a1%ae%e8%ae%a1%e7%ae%97python%e7%a8%8b%e5%ba%8f%e7%9a%84%e8%bf%90%e8%a1%8c%e6%97%b6%e9%97%b4%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/204078\/","title":{"rendered":"\u5982\u4f55\u7cbe\u786e\u8ba1\u7b97Python\u7a0b\u5e8f\u7684\u8fd0\u884c\u65f6\u95f4\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u7cbe\u786e\u8ba1\u7b97Python\u7a0b\u5e8f\u7684\u8fd0\u884c\u65f6\u95f4\uff1f<\/h1>\n<p>\u7f16\u7a0b\u5e76\u4e0d\u662f\u4e00\u4e2a\u673a\u68b0\u6027\u7684\u5de5\u4f5c\uff0c\u800c\u662f\u9700\u8981\u6709\u601d\u8003\uff0c\u6709\u521b\u65b0\u7684\u5de5\u4f5c\uff0c\u8bed\u6cd5\u662f\u56fa\u5b9a\u7684\uff0c\u4f46\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u5219\u662f\u4f9d\u9760\u4eba\u7684\u601d\u7ef4\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u575a\u6301\u5b66\u4e60\u548c\u66f4\u65b0\u81ea\u5df1\u7684\u77e5\u8bc6\u3002\u4eca\u5929\u5c31\u6574\u7406\u5206\u4eab\u300a\u5982\u4f55\u7cbe\u786e\u8ba1\u7b97Python\u7a0b\u5e8f\u7684\u8fd0\u884c\u65f6\u95f4\uff1f\u300b\uff0c\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\uff0c\u5728\u8fd9\u53ef\u4ee5\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5f00\u53d1\u80fd\u529b\u7684\u63d0\u5347\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241027\/1729989588671d8bd4da420.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u5982\u4f55\u7cbe\u786e\u8ba1\u7b97python\u7a0b\u5e8f\u7684\u8fd0\u884c\u65f6\u95f4<\/strong><\/p>\n<p>\u60f3\u8981\u4e86\u89e3\u7a0b\u5e8f\u5b8c\u6210\u6240\u9700\u7684\u65f6\u95f4\uff0ctimeit\u6a21\u5757\u663e\u7136\u4e0d\u662f\u6700\u4f73\u9009\u62e9\uff0c\u56e0\u4e3a\u5b83\u4ec5\u53ef\u7528\u4e8e\u8ba1\u65f6\u7b80\u77ed\u7684\u4ee3\u7801\u7247\u6bb5\u3002<\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u53ef\u4ee5\u501f\u52a9python\u4e2d\u6700\u7b80\u5355\u7684\u65b9\u6cd5\uff1a<\/p>\n<pre>import time\nstart_time = time.time()\nmain()\nprint(\"\u7a0b\u5e8f\u8fd0\u884c\u65f6\u95f4\uff1a%s \u79d2\" % (time.time() - start_time))<\/pre>\n<p>\u5728\u7a0b\u5e8f\u6267\u884c\u4e4b\u524d\uff0c\u83b7\u53d6\u4e00\u4e2a\u65f6\u95f4\u6233\u5e76\u5c06\u5176\u5b58\u50a8\u5728start_time\u4e2d\uff0c\u7136\u540e\u6b63\u5e38\u6267\u884c\u7a0b\u5e8f\u3002\u6267\u884c\u7ed3\u675f\u540e\uff0c\u8ba1\u7b97\u76f8\u5bf9\u4e8estart_time\u7684\u7a0b\u5e8f\u8fd0\u884c\u65f6\u95f4\u5e76\u5c06\u5176\u6253\u5370\u8f93\u51fa\u3002\u8bf7\u6ce8\u610f\uff0c\u6b64\u65b9\u6cd5\u9002\u7528\u4e8e\u7a0b\u5e8f\u8fd0\u884c\u65f6\u95f4\u81f3\u5c11\u4e3a\u5341\u5206\u4e4b\u4e00\u79d2\u7684\u60c5\u51b5\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u8f93\u51fa\u53ef\u80fd\u4e3a\uff1a<\/p>\n<pre>\u7a0b\u5e8f\u8fd0\u884c\u65f6\u95f4\uff1a0.764891862869 \u79d2<\/pre>\n<p>\u597d\u4e86\uff0c\u672c\u6587\u5230\u6b64\u7ed3\u675f\uff0c\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u300a\u5982\u4f55\u7cbe\u786e\u8ba1\u7b97Python\u7a0b\u5e8f\u7684\u8fd0\u884c\u65f6\u95f4\uff1f\u300b\uff0c\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff01\u5173\u6ce8\u516c\u4f17\u53f7\uff0c\u7ed9\u5927\u5bb6\u5206\u4eab\u66f4\u591a\u6587\u7ae0\u77e5\u8bc6\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u7cbe\u786e\u8ba1\u7b97Python\u7a0b\u5e8f\u7684\u8fd0&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-204078","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204078","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=204078"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204078\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=204078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=204078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=204078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}