{"id":123626,"date":"2026-11-07T22:01:16","date_gmt":"2026-11-07T14:01:16","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/123626.html"},"modified":"2026-11-07T22:01:16","modified_gmt":"2026-11-07T14:01:16","slug":"%e5%a6%82%e4%bd%95%e7%94%a8with%e8%af%ad%e5%8f%a5%e7%ae%80%e5%8c%96%e4%bd%a0%e7%9a%84python%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/123626.html","title":{"rendered":"\u5982\u4f55\u7528with\u8bed\u53e5\u7b80\u5316\u4f60\u7684Python\u4ee3\u7801"},"content":{"rendered":"<p>        \/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/<br \/>\n        #content_views .toc,<br \/>\n        \/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/<br \/>\n        #content_views.markdown_views &gt; p:empty:has(+ .toc),<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty,<br \/>\n        \/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/<br \/>\n        #content_views.htmledit_views #main-toc,<br \/>\n        #content_views.htmledit_views #hr-toc,<br \/>\n        #content_views.htmledit_views p[id*=\\&#8221;-toc\\&#8221;] {<br \/>\n          display: none !important;<br \/>\n        }<br \/>\n        \/* \u76ee\u5f55\u53bb\u6389\u540e\uff0c\u7d27\u8ddf\u7684\u9996\u4e2a\u6807\u9898\u4e0d\u518d\u591a\u51fa\u4e00\u5757\u4e0a\u8fb9\u8ddd *\/<br \/>\n        #content_views.markdown_views &gt; .toc + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + h4,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h4 {<br \/>\n          margin-top: 0 !important;<br \/>\n        }<\/p>\n<p>Python\u662f\u4e00\u95e8\u4f18\u96c5\u800c\u7b80\u6d01\u7684\u7f16\u7a0b\u8bed\u8a00&#xff0c;\u5b83\u63d0\u4f9b\u4e86\u8bb8\u591a\u9ad8\u7ea7\u7279\u6027&#xff0c;\u8ba9\u6211\u4eec\u7684\u7f16\u7a0b\u66f4\u52a0\u65b9\u4fbf\u548c\u9ad8\u6548\u3002\u5176\u4e2d\u4e00\u4e2a\u7279\u6027\u5c31\u662fwith\u8bed\u53e5&#xff0c;\u5b83\u53ef\u4ee5\u8ba9\u6211\u4eec\u5728\u5904\u7406\u4e00\u4e9b\u9700\u8981\u6253\u5f00\u548c\u5173\u95ed\u8d44\u6e90\u7684\u64cd\u4f5c\u65f6&#xff0c;\u4e0d\u7528\u62c5\u5fc3\u5fd8\u8bb0\u5173\u95ed\u8d44\u6e90\u6216\u8005\u51fa\u73b0\u5f02\u5e38\u3002\u5728\u672c\u6587\u4e2d&#xff0c;\u6211\u5c06\u4ecb\u7ecd\u4e00\u4e0bwith\u8bed\u53e5\u7684\u7528\u6cd5\u548c\u7528\u9014&#xff0c;\u4ee5\u53ca\u5b83\u5728Python 3.6\u4e2d\u65b0\u589e\u7684\u4e00\u4e9b\u529f\u80fd\u3002<\/p>\n<h3>with\u8bed\u53e5\u7684\u57fa\u672c\u7528\u6cd5<\/h3>\n<p>with\u8bed\u53e5\u7684\u57fa\u672c\u8bed\u6cd5\u662f\u8fd9\u6837\u7684&#xff1a;<\/p>\n<p>with expression as variable:<br \/>\n    # do something with variable<\/p>\n<p>expression\u662f\u4e00\u4e2a\u8868\u8fbe\u5f0f&#xff0c;\u5b83\u4f1a\u8fd4\u56de\u4e00\u4e2a\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668&#xff08;context manager&#xff09;&#xff0c;\u8fd9\u662f\u4e00\u4e2a\u5b9e\u73b0\u4e86__enter__\u548c__exit__\u65b9\u6cd5\u7684\u5bf9\u8c61\u3002variable\u662f\u4e00\u4e2a\u53d8\u91cf&#xff0c;\u5b83\u4f1a\u63a5\u6536__enter__\u65b9\u6cd5\u8fd4\u56de\u7684\u503c\u3002\u5f53\u8fdb\u5165with\u8bed\u53e5\u65f6&#xff0c;\u4f1a\u8c03\u7528\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668\u7684__enter__\u65b9\u6cd5&#xff0c;\u5e76\u5c06\u8fd4\u56de\u503c\u8d4b\u7ed9variable\u3002\u5f53\u79bb\u5f00with\u8bed\u53e5\u65f6&#xff0c;\u4f1a\u8c03\u7528\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668\u7684__exit__\u65b9\u6cd5&#xff0c;\u5e76\u4f20\u5165\u5f02\u5e38\u4fe1\u606f&#xff08;\u5982\u679c\u6709\u7684\u8bdd&#xff09;\u3002<\/p>\n<p>with\u8bed\u53e5\u7684\u4f5c\u7528\u662f\u8ba9\u6211\u4eec\u53ef\u4ee5\u5728\u6267\u884c\u4e00\u4e9b\u64cd\u4f5c\u4e4b\u524d\u548c\u4e4b\u540e&#xff0c;\u81ea\u52a8\u6267\u884c\u4e00\u4e9b\u6e05\u7406\u6216\u8005\u91ca\u653e\u8d44\u6e90\u7684\u64cd\u4f5c\u3002\u6bd4\u5982&#xff0c;\u5f53\u6211\u4eec\u8981\u6253\u5f00\u4e00\u4e2a\u6587\u4ef6\u5e76\u8bfb\u53d6\u5185\u5bb9\u65f6&#xff0c;\u6211\u4eec\u901a\u5e38\u8981\u8fd9\u6837\u5199&#xff1a;<\/p>\n<p>f &#061; open(&#039;test.txt&#039;, &#039;r&#039;)<br \/>\ncontent &#061; f.read()<br \/>\nf.close()<\/p>\n<p>\u8fd9\u6837\u5199\u6709\u4e24\u4e2a\u95ee\u9898&#xff1a;\u4e00\u662f\u5982\u679c\u8bfb\u53d6\u6587\u4ef6\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u5f02\u5e38&#xff0c;\u53ef\u80fd\u5bfc\u81f4\u6587\u4ef6\u6ca1\u6709\u5173\u95ed&#xff1b;\u4e8c\u662f\u6bcf\u6b21\u90fd\u8981\u5199f.close()\u5f88\u9ebb\u70e6\u3002\u5982\u679c\u6211\u4eec\u7528with\u8bed\u53e5&#xff0c;\u5c31\u53ef\u4ee5\u7b80\u5316\u4e3a&#xff1a;<\/p>\n<p>with open(&#039;test.txt&#039;, &#039;r&#039;) as f:<br \/>\n    content &#061; f.read()<\/p>\n<p>\u8fd9\u6837\u5199\u7684\u597d\u5904\u662f&#xff1a;\u4e00\u662f\u4e0d\u7ba1\u8bfb\u53d6\u6587\u4ef6\u8fc7\u7a0b\u4e2d\u662f\u5426\u51fa\u73b0\u5f02\u5e38&#xff0c;\u90fd\u4f1a\u81ea\u52a8\u5173\u95ed\u6587\u4ef6&#xff1b;\u4e8c\u662f\u4ee3\u7801\u66f4\u52a0\u7b80\u6d01\u548c\u6e05\u6670\u3002\u8fd9\u662f\u56e0\u4e3aopen\u51fd\u6570\u8fd4\u56de\u7684\u662f\u4e00\u4e2a\u6587\u4ef6\u5bf9\u8c61&#xff0c;\u5b83\u5b9e\u73b0\u4e86\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668\u534f\u8bae&#xff0c;\u6240\u4ee5\u53ef\u4ee5\u7528\u5728with\u8bed\u53e5\u4e2d\u3002<\/p>\n<h3>with\u8bed\u53e5\u7684\u8fdb\u9636\u7528\u6cd5<\/h3>\n<p>\u9664\u4e86\u53ef\u4ee5\u7528\u5728\u5185\u7f6e\u7684\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668\u5bf9\u8c61\u4e0a&#xff0c;\u6211\u4eec\u4e5f\u53ef\u4ee5\u81ea\u5df1\u5b9a\u4e49\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668\u7c7b&#xff0c;\u5e76\u7528\u5728with\u8bed\u53e5\u4e2d\u3002\u6bd4\u5982&#xff0c;\u6211\u4eec\u60f3\u8981\u5b9e\u73b0\u4e00\u4e2a\u8ba1\u65f6\u5668\u7c7b&#xff0c;\u5b83\u53ef\u4ee5\u5728\u8fdb\u5165\u548c\u79bb\u5f00\u67d0\u4e2a\u4ee3\u7801\u5757\u65f6&#xff0c;\u6253\u5370\u51fa\u6267\u884c\u65f6\u95f4\u3002\u6211\u4eec\u53ef\u4ee5\u8fd9\u6837\u5199&#xff1a;<\/p>\n<p>import time<\/p>\n<p>class Timer:<br \/>\n    def __enter__(self):<br \/>\n        self.start &#061; time.time()<br \/>\n        return self<\/p>\n<p>    def __exit__(self, exc_type, exc_value, exc_traceback):<br \/>\n        self.end &#061; time.time()<br \/>\n        print(f&#039;Elapsed time: {self.end &#8211; self.start} seconds&#039;)<\/p>\n<p>\u7136\u540e\u6211\u4eec\u5c31\u53ef\u4ee5\u8fd9\u6837\u4f7f\u7528&#xff1a;<\/p>\n<p>with Timer() as t:<br \/>\n    # do some heavy computation<br \/>\n    time.sleep(3)<\/p>\n<p>\u8f93\u51fa&#xff1a;<\/p>\n<p>Elapsed time: 3.000213861465454 seconds<\/p>\n<p>\u5728Python 3.6\u4e2d&#xff0c;with\u8bed\u53e5\u8fd8\u589e\u52a0\u4e86\u4e00\u4e9b\u65b0\u529f\u80fd\u3002\u6bd4\u5982&#xff0c;\u6211\u4eec\u53ef\u4ee5\u5728\u4e00\u4e2awith\u8bed\u53e5\u4e2d\u4f7f\u7528\u591a\u4e2a\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668&#xff0c;\u53ea\u8981\u7528\u9017\u53f7\u5206\u9694\u5373\u53ef\u3002\u6bd4\u5982&#xff1a;<\/p>\n<p>with open(&#039;test.txt&#039;, &#039;r&#039;) as f1, open(&#039;test_copy.txt&#039;, &#039;w&#039;) as f2:<br \/>\n    # copy content from f1 to f2<\/p>\n<p>\u8fd9\u6837\u5c31\u53ef\u4ee5\u540c\u65f6\u6253\u5f00\u4e24\u4e2a\u6587\u4ef6&#xff0c;\u5e76\u5728\u79bb\u5f00\u65f6\u81ea\u52a8\u5173\u95ed\u3002<\/p>\n<p>\u53e6\u5916&#xff0c;\u6211\u4eec\u8fd8\u53ef\u4ee5\u4f7f\u7528async with\u8bed\u53e5&#xff0c;\u5728\u5f02\u6b65\u7f16\u7a0b\u4e2d\u4f7f\u7528\u5f02\u6b65\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668\u3002\u5f02\u6b65\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668\u662f\u5b9e\u73b0\u4e86__aenter__\u548c__aexit__\u65b9\u6cd5\u7684\u5bf9\u8c61&#xff0c;\u5b83\u4eec\u53ef\u4ee5\u5728\u534f\u7a0b\u4e2d\u4f7f\u7528&#xff0c;\u5e76\u4e14\u652f\u6301await\u8bed\u6cd5\u3002\u6bd4\u5982&#xff1a;<\/p>\n<p>import aiohttp<br \/>\nimport asyncio<\/p>\n<p>async def fetch(url):<br \/>\n    async with aiohttp.ClientSession() as session:<br \/>\n        async with session.get(url) as response:<br \/>\n            return await response.text()<\/p>\n<p>async def main():<br \/>\n    html &#061; await fetch(&#039;https:\/\/www.python.org&#039;)<br \/>\n    print(html)<\/p>\n<p>asyncio.run(main())<\/p>\n<p>\u8fd9\u6837\u5c31\u53ef\u4ee5\u4f7f\u7528aiohttp\u5e93&#xff0c;\u5f02\u6b65\u5730\u83b7\u53d6\u7f51\u9875\u5185\u5bb9&#xff0c;\u5e76\u5728\u79bb\u5f00\u65f6\u81ea\u52a8\u5173\u95ed\u4f1a\u8bdd\u548c\u54cd\u5e94\u3002<\/p>\n<h3>\u603b\u7ed3<\/h3>\n<p>with\u8bed\u53e5\u662fPython\u4e2d\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u7279\u6027&#xff0c;\u5b83\u53ef\u4ee5\u8ba9\u6211\u4eec\u5728\u5904\u7406\u4e00\u4e9b\u9700\u8981\u6253\u5f00\u548c\u5173\u95ed\u8d44\u6e90\u7684\u64cd\u4f5c\u65f6&#xff0c;\u4e0d\u7528\u62c5\u5fc3\u5fd8\u8bb0\u5173\u95ed\u8d44\u6e90\u6216\u8005\u51fa\u73b0\u5f02\u5e38\u3002\u5b83\u8fd8\u53ef\u4ee5\u8ba9\u6211\u4eec\u7684\u4ee3\u7801\u66f4\u52a0\u7b80\u6d01\u548c\u6e05\u6670\u3002\u5728Python 3.6\u4e2d&#xff0c;with\u8bed\u53e5\u8fd8\u589e\u52a0\u4e86\u4e00\u4e9b\u65b0\u529f\u80fd&#xff0c;\u8ba9\u6211\u4eec\u53ef\u4ee5\u5728\u4e00\u4e2awith\u8bed\u53e5\u4e2d\u4f7f\u7528\u591a\u4e2a\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668&#xff0c;\u6216\u8005\u5728\u5f02\u6b65\u7f16\u7a0b\u4e2d\u4f7f\u7528\u5f02\u6b65\u4e0a\u4e0b\u6587\u7ba1\u7406\u5668\u3002\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u4f7f\u7528\u8fc7with\u8bed\u53e5&#xff0c;\u90a3\u4e48\u6211\u5efa\u8bae\u4f60\u5c1d\u8bd5\u4e00\u4e0b&#xff0c;\u4f60\u4f1a\u53d1\u73b0\u5b83\u7684\u9b45\u529b\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[81,87,190],"topic":[],"class_list":["post-123626","post","type-post","status-publish","format-standard","hentry","category-server","tag-python","tag-87","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5982\u4f55\u7528with\u8bed\u53e5\u7b80\u5316\u4f60\u7684Python\u4ee3\u7801 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/123626.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5982\u4f55\u7528with\u8bed\u53e5\u7b80\u5316\u4f60\u7684Python\u4ee3\u7801 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/123626.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-07T14:01:16+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/123626.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/123626.html\",\"name\":\"\u5982\u4f55\u7528with\u8bed\u53e5\u7b80\u5316\u4f60\u7684Python\u4ee3\u7801 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-11-07T14:01:16+00:00\",\"dateModified\":\"2026-11-07T14:01:16+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/123626.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/123626.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/123626.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5982\u4f55\u7528with\u8bed\u53e5\u7b80\u5316\u4f60\u7684Python\u4ee3\u7801\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5982\u4f55\u7528with\u8bed\u53e5\u7b80\u5316\u4f60\u7684Python\u4ee3\u7801 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/123626.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5982\u4f55\u7528with\u8bed\u53e5\u7b80\u5316\u4f60\u7684Python\u4ee3\u7801 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content","og_url":"https:\/\/www.wsisp.com\/helps\/123626.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-11-07T14:01:16+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/123626.html","url":"https:\/\/www.wsisp.com\/helps\/123626.html","name":"\u5982\u4f55\u7528with\u8bed\u53e5\u7b80\u5316\u4f60\u7684Python\u4ee3\u7801 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-11-07T14:01:16+00:00","dateModified":"2026-11-07T14:01:16+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/123626.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/123626.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/123626.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5982\u4f55\u7528with\u8bed\u53e5\u7b80\u5316\u4f60\u7684Python\u4ee3\u7801"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/123626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=123626"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/123626\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=123626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=123626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=123626"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=123626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}