{"id":372,"date":"2025-05-30T21:06:39","date_gmt":"2025-05-30T13:06:39","guid":{"rendered":"https:\/\/cn1.club\/?p=372"},"modified":"2025-05-30T21:08:27","modified_gmt":"2025-05-30T13:08:27","slug":"python%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%e6%90%9e%e6%87%82-asyncio%e4%bb%8e%e5%85%a5%e9%97%a8%e5%88%b0%e4%b8%8d%e8%b8%a9%e5%9d%91","status":"publish","type":"post","link":"https:\/\/cn1.club\/?p=372","title":{"rendered":"Python\u5b66\u4e60\u7b14\u8bb0:\u641e\u61c2 asyncio\u4ece\u5165\u95e8\u5230\u4e0d\u8e29\u5751"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >import asyncio\n\nasync def f1():\n    print(&#039;123&#039;)\n    await asyncio.sleep(1)\n    print(&#039;456&#039;)\n    return(&quot;f1\u5b8c\u6210&quot;)\n\nasync def f2():\n    print(&quot;abc&quot;)\n    #time.sleep()\u4e0d\u80fd\u5728async\u534f\u7a0b\u51fd\u6570\u4e2d\u4f7f\u7528, \u56e0\u4e3a\u5b83\u662ftime\u5e93\u63d0\u4f9b\u7684\u4e00\u4e2a \u540c\u6b65\u963b\u585e \u51fd\u6570, \u8c03\u7528\u5b83\u4f1a\u6682\u505c\u6574\u4e2a\u7a0b\u5e8f\u7684\u6267\u884c\u6d41.\n    #await -&gt; \u5728 async \u51fd\u6570\u5185\u90e8\uff0c\u8981\u201c\u7b49\u5f85\u201d\u4e00\u4e2a\u53ef\u7b49\u5f85\u5bf9\u8c61\u5b8c\u6210\uff0c\u5fc5\u987b\u4f7f\u7528 await \u5173\u952e\u5b57\u3002\n    # await \u5173\u952e\u5b57\u7684\u4f5c\u7528\u5c31\u662f\u6682\u505c\u5f53\u524d\u534f\u7a0b\u7684\u6267\u884c\uff0c\u5e76\u5c06\u63a7\u5236\u6743\u4ea4\u7ed9\u4e8b\u4ef6\u5faa\u73af\uff0c\u76f4\u5230\u88ab await \u7684\u53ef\u7b49\u5f85\u5bf9\u8c61\u5b8c\u6210\u3002\n    &quot;&quot;&quot;\n    await    \u5b83\u66f4\u5e7f\u6cdb\u5730\u5e94\u7528\u4e8e\u4efb\u4f55\u53ef\u80fd\u9700\u8981\u7b49\u5f85\u7684\u3001I\/O \u5bc6\u96c6\u578b\u7684\u3001\u5f02\u6b65\u64cd\u4f5c,\u5982:\u7b49\u5f85http\u8bf7\u6c42\u8fd4\u56de\u54cd\u5e94\u65f6,\n    \u4f8b\u5982\uff0c\u7b49\u5f85 HTTP \u8bf7\u6c42\u8fd4\u56de\u54cd\u5e94\u3001\u8bfb\u5199\u6587\u4ef6\u3001\u7f51\u7edc\u8fde\u63a5\u3001\u6570\u636e\u5e93\u67e5\u8be2\u7b49\u7b49\uff0c\n    \u8fd9\u4e9b\u64cd\u4f5c\u7684\u5171\u540c\u7279\u70b9\u662f\uff1a\u5b83\u4eec\u5728\u6267\u884c\u8fc7\u7a0b\u4e2d\u4f1a\u6709\u4e00\u6bb5\u7b49\u5f85\u65f6\u95f4\uff08\u7b49\u5f85\u6570\u636e\u4ece\u7f51\u7edc\u4f20\u8f93\u3001\u7b49\u5f85\u786c\u76d8\u8bfb\u5199\u7b49\uff09\u3002\n    #!\u4e5f\u5c31\u662f\u8bf4 , \u5728async\u534f\u7a0b\u51fd\u6570\u4e2d, \u4e0d\u5149\u662fsleep\u8fd9\u6837\u7684\u64cd\u4f5c, \u4f8b\u5982 \u7b49\u5f85http\u8bf7\u6c42\u8fd4\u56de\u54cd\u5e94\u6bd4\u8f83\u8017\u65f6\u7684\u64cd\u4f5c, \u4e5f\u53ef\u4ee5\u7528await\u6807\u6ce8, \u5c06\u8fd9\u4e2a\u53ef\u80fd\u8017\u65f6\u7684\u64cd\u4f5c \u5728\u7b49\u5f85\u7684\u65f6\u5019 \u4ea4\u7ed9async\u53bb\u5148\u6267\u884c\u5176\u4ed6 \u5faa\u73af\u4e8b\u4ef6\n      &quot;&quot;&quot;\n    await asyncio.sleep(1) \n    print(&#039;def&#039;)\n    return(&quot;f2\u5b8c\u6210&quot;)\n\nasync def main():\n    #\u5c06 async\u534f\u7a0b\u5bf9\u8c61\u5c01\u88c5\u4e3atask\u5bf9\u8c61\n    task1 = asyncio.create_task(f1())\n    task2 = asyncio.create_task(f2())\n\n    #asyncio.wait(&#091;func1(),func2&#091;]]) \u8fd4\u56de \u5df2\u5b8c\u6210\u7684\u4efb\u52a1\u96c6\u5408 \u548c \u672a\u5b8c\u6210\u7684\u4efb\u52a1\u96c6\u5408\n    #asyncio.wait() \u662f\u4e00\u4e2a\u534f\u7a0b\u51fd\u6570\uff0c\u5b83\u8fd4\u56de\u4e00\u4e2a\u53ef\u7b49\u5f85\u5bf9\u8c61\u3002\u8981\u8ba9\u5b83\u5b9e\u9645\u6267\u884c\u5e76\u7b49\u5f85\u4efb\u52a1\u5b8c\u6210\uff0c\u5fc5\u987b\u5728\u5b83\u524d\u9762\u52a0\u4e0a await \u5173\u952e\u5b57\u3002\n    done, pending = await asyncio.wait(&#091;task1,task2])\n    for task in done:\n        print (f&quot;\u5b8c\u6210\u7684:{task.result()}&quot;)\n    if pending:\n        print(f&quot;\u672a\u5b8c\u6210\u7684:{pending}&quot;)\n    \nif __name__ == &#039;__main__&#039;:\n#loop = asyncio.get_event_loop()    # \u83b7\u53d6\u4e8b\u4ef6\u5faa\u73af\n#loop.run_until_comlete( result )   # \u8fd0\u884c\u4e8b\u4ef6\u5faa\u73af\n# \u5728 python3.7 \u4e4b\u540e\uff0c\u53ef\u4ee5\u7701\u7565\u4e0a\u9762\u4e24\u884c\uff0c\u76f4\u63a5\u6267\u884c\u4e0b\u9762\u4e00\u884c\u51fd\u6570\u5373\u53ef\n    asyncio.run(main())\n\n\n<\/code><\/pre>\n\n\n\n<p>\u521a\u5f00\u59cb\u63a5\u89e6 Python \u91cc\u7684 <code class=\"prettyprint\" >asyncio<\/code> \u89c9\u5f97\u6709\u70b9\u513f\u7ed5\u3002\u73b0\u5b66\u73b0\u73b0\u8bb0,\u73b0\u5728\u5c31\u8bb0\u5f55\u4e0b\u5b66\u4e60 <code class=\"prettyprint\" >asyncio<\/code> \u65f6\u7ecf\u5e38\u4f1a\u9047\u5230\u7684\u51e0\u4e2a\u5730\u65b9\uff0c\u628a\u4e00\u4e9b\u6982\u5ff5\u5f04\u6e05\u695a\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-0\">1. <code class=\"prettyprint\" >asyncio.sleep()<\/code> \u548c <code class=\"prettyprint\" >time.sleep()<\/code> \u6709\u4ec0\u4e48\u4e0d\u540c\uff1f<\/h3>\n\n\n\n<p>\u5f53\u4f60\u9700\u8981\u5728 <code class=\"prettyprint\" >asyncio<\/code> \u7684\u7a0b\u5e8f\u91cc\u8ba9\u4ee3\u7801\u6682\u505c\u4e00\u4f1a\u513f\u65f6\uff0c\u53ef\u80fd\u4f1a\u60f3\u5230\u7528 <code class=\"prettyprint\" >sleep<\/code>\u3002\u4f46\u8fd9\u91cc\u9762\u6709\u4e2a<strong>\u5c0f\u79d8\u5bc6<\/strong>\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code class=\"prettyprint\" >time.sleep(1)<\/code>\uff1a<\/strong> \u8fd9\u662f Python \u6807\u51c6\u5e93\u91cc\u7684\u4e00\u4e2a\u51fd\u6570\u3002\u5982\u679c\u4f60\u5728 <code class=\"prettyprint\" >async<\/code> \u51fd\u6570\u91cc\u7528\u5b83\uff0c\u6bd4\u5982 <code class=\"prettyprint\" >time.sleep(1)<\/code>\uff0c\u4f60\u7684\u6574\u4e2a\u7a0b\u5e8f\u4f1a<strong>\u5b8c\u5168\u505c\u4e0b\u6765 1 \u79d2<\/strong>\u3002\u8fd9\u5c31\u50cf\u6309\u4e86\u7a0b\u5e8f\u7684\u6682\u505c\u952e\uff0c\u5176\u4ed6\u6240\u6709\u7684\u4efb\u52a1\u90fd\u5f97\u8ddf\u7740\u4e00\u8d77\u7b49\u3002\u5728 <code class=\"prettyprint\" >asyncio<\/code> \u91cc\uff0c\u6211\u4eec\u5e0c\u671b\u7684\u662f\u591a\u4e2a\u4efb\u52a1\u80fd\u8f6e\u6d41\u6267\u884c\uff0c\u800c\u4e0d\u662f\u4e92\u76f8\u7b49\u5f85\u3002\u6240\u4ee5\uff0c<code class=\"prettyprint\" >time.sleep()<\/code> \u4f1a<strong>\u963b\u585e<\/strong> <code class=\"prettyprint\" >asyncio<\/code> \u7684\u201c\u4e8b\u4ef6\u5faa\u73af\u201d\uff0c\u8ba9\u5e76\u53d1\u5931\u6548\u3002<\/li>\n\n\n\n<li><strong><code class=\"prettyprint\" >asyncio.sleep(1)<\/code>\uff1a<\/strong> \u8fd9\u4e2a\u662f <code class=\"prettyprint\" >asyncio<\/code> \u5e93\u4e13\u95e8\u63d0\u4f9b\u7684\u3002\u5f53\u4f60\u5199 <code class=\"prettyprint\" >await asyncio.sleep(1)<\/code> \u65f6\uff0c\u4f60\u544a\u8bc9\u7a0b\u5e8f\uff1a\u201c\u6211\u8fd9\u4e2a\u4efb\u52a1\u8981\u7b49 1 \u79d2\uff0c\u4f60\u5148\u53bb\u770b\u770b\u6709\u6ca1\u6709\u5176\u4ed6\u4efb\u52a1\u53ef\u4ee5\u8dd1\uff0c\u7b49 1 \u79d2\u5230\u4e86\u518d\u56de\u6765\u53eb\u6211\u3002\u201d \u8fd9\u6837\uff0c<code class=\"prettyprint\" >asyncio<\/code> \u5c31\u53ef\u4ee5\u5728\u7b49\u5f85\u7684\u8fd9 1 \u79d2\u91cc\u53bb\u5904\u7406\u5176\u4ed6\u4efb\u52a1\uff0c\u5b9e\u73b0<strong>\u5e76\u53d1<\/strong>\u3002\u5b83\u4e0d\u4f1a\u963b\u585e\u6574\u4e2a\u7a0b\u5e8f\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong>\u7b80\u5355\u6765\u8bf4\uff1a<\/strong> \u5728 <code class=\"prettyprint\" >async<\/code> \u51fd\u6570\u91cc\uff0c\u9700\u8981\u6682\u505c\u7684\u8bdd\uff0c\u4e00\u5b9a\u8981\u7528 <strong><code class=\"prettyprint\" >await asyncio.sleep()<\/code><\/strong>\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-1\">2. \u4e3a\u4ec0\u4e48 <code class=\"prettyprint\" >asyncio.sleep()<\/code> \u524d\u9762\u8981\u52a0 <code class=\"prettyprint\" >await<\/code>\uff1f<\/h3>\n\n\n\n<p>\u4f60\u53ef\u80fd\u4f1a\u95ee\uff0c\u65e2\u7136\u7528\u4e86 <code class=\"prettyprint\" >asyncio.sleep()<\/code>\uff0c\u4e3a\u4ec0\u4e48\u524d\u9762\u8fd8\u8981\u52a0\u4e2a <code class=\"prettyprint\" >await<\/code> \u5462\uff1f<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code class=\"prettyprint\" >await<\/code> \u7684\u4f5c\u7528\uff1a<\/strong> <code class=\"prettyprint\" >await<\/code> \u5c31\u50cf\u4e00\u4e2a\u201c\u7b49\u5f85\u201d\u7684\u4fe1\u53f7\u3002\u5b83\u544a\u8bc9 Python\uff0c\u5b83\u540e\u9762\u8ddf\u7740\u7684\u64cd\u4f5c\uff08\u6bd4\u5982 <code class=\"prettyprint\" >asyncio.sleep(1)<\/code> \u6216\u8005\u4e00\u4e2a\u7f51\u7edc\u8bf7\u6c42\uff09\u53ef\u80fd\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\u624d\u80fd\u5b8c\u6210\u3002\u5f53\u7a0b\u5e8f\u9047\u5230 <code class=\"prettyprint\" >await<\/code> \u65f6\uff0c\u5b83\u4f1a<strong>\u6682\u65f6\u505c\u4e0b\u5f53\u524d\u4efb\u52a1<\/strong>\uff0c\u628a\u63a7\u5236\u6743\u4ea4\u7ed9 <code class=\"prettyprint\" >asyncio<\/code> \u7684\u201c\u4e8b\u4ef6\u5faa\u73af\u201d\u3002\u4e8b\u4ef6\u5faa\u73af\u5c31\u80fd\u8d81\u8fd9\u4e2a\u673a\u4f1a\u53bb\u6267\u884c\u5176\u4ed6\u5df2\u7ecf\u51c6\u5907\u597d\u7684\u4efb\u52a1\u3002\u7b49\u5230\u4e4b\u524d\u88ab <code class=\"prettyprint\" >await<\/code> \u7684\u64cd\u4f5c\u5b8c\u6210\u4e86\uff0c\u4e8b\u4ef6\u5faa\u73af\u518d\u56de\u6765\u8ba9\u8fd9\u4e2a\u4efb\u52a1\u7ee7\u7eed\u6267\u884c\u3002<\/li>\n\n\n\n<li><strong>\u4e0d\u52a0 <code class=\"prettyprint\" >await<\/code> \u4f1a\u600e\u6837\uff1f<\/strong> \u5982\u679c\u4f60\u53ea\u5199 <code class=\"prettyprint\" >asyncio.sleep(1)<\/code> \u800c\u4e0d\u52a0 <code class=\"prettyprint\" >await<\/code>\uff0c\u7a0b\u5e8f\u4f1a\u521b\u5efa\u4e00\u4e2a\u201c\u4efb\u52a1\u5bf9\u8c61\u201d\uff0c\u4f46\u8fd9\u4e2a\u4efb\u52a1\u5bf9\u8c61\u5e76\u4e0d\u4f1a\u88ab\u771f\u6b63\u5730\u201c\u7b49\u5f85\u201d\u548c\u6267\u884c\u3002\u5b83\u5c31\u50cf\u4f60\u5efa\u4e86\u4e00\u4e2a\u623f\u5b50\u56fe\u7eb8\uff0c\u4f46\u6ca1\u5f00\u59cb\u76d6\u3002\u4f60\u53ef\u80fd\u4f1a\u770b\u5230\u4e00\u4e2a\u8b66\u544a\uff0c\u544a\u8bc9\u4f60\u8fd9\u4e2a\u534f\u7a0b\u201c\u4ece\u6ca1\u88ab\u7b49\u5f85\u8fc7\u201d\u3002\u800c\u4e14\uff0c\u7a0b\u5e8f\u4e5f\u4e0d\u4f1a\u771f\u7684\u6682\u505c\u3002<\/li>\n<\/ul>\n\n\n\n<p><strong>\u6240\u4ee5\uff1a<\/strong> \u5728 <code class=\"prettyprint\" >async<\/code> \u51fd\u6570\u91cc\uff0c\u4efb\u4f55\u9700\u8981\u7b49\u5f85\u5f02\u6b65\u64cd\u4f5c\u7684\u5730\u65b9\uff0c\u6bd4\u5982 <strong><code class=\"prettyprint\" >asyncio.sleep()<\/code> \u6216\u8005\u53d1\u9001\u7f51\u7edc\u8bf7\u6c42\uff0c\u524d\u9762\u90fd\u5fc5\u987b\u52a0\u4e0a <code class=\"prettyprint\" >await<\/code><\/strong>\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"toc-2\">3. \u5728 <code class=\"prettyprint\" >async<\/code> \u51fd\u6570\u91cc\uff0c\u9664\u4e86 <code class=\"prettyprint\" >sleep<\/code>\uff0c\u8fd8\u6709\u54ea\u4e9b\u64cd\u4f5c\u4e5f\u9700\u8981 <code class=\"prettyprint\" >await<\/code>\uff1f<\/h3>\n\n\n\n<p><code class=\"prettyprint\" >await<\/code> \u4e0d\u4ec5\u4ec5\u662f\u4e3a\u4e86 <code class=\"prettyprint\" >sleep<\/code>\u3002\u5b83\u7684\u771f\u6b63\u5389\u5bb3\u4e4b\u5904\u5728\u4e8e\u5904\u7406\u90a3\u4e9b<strong>\u8017\u65f6\u4f46\u53c8\u4e0d\u9700\u8981\u4e00\u76f4\u5360\u7528 CPU \u7684\u64cd\u4f5c<\/strong>\u3002<\/p>\n\n\n\n<p>\u60f3\u8c61\u4e00\u4e0b\uff0c\u4f60\u7684\u7a0b\u5e8f\u9700\u8981\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u53d1\u9001\u4e00\u4e2a HTTP \u8bf7\u6c42\u5e76\u7b49\u5f85\u54cd\u5e94\uff1a<\/strong> \u6bd4\u5982\u4ece\u7f51\u7ad9\u4e0a\u4e0b\u8f7d\u6570\u636e\u3002\u8fd9\u4f1a\u6d89\u53ca\u5230\u7f51\u7edc\u4f20\u8f93\uff0c\u9700\u8981\u7b49\u5f85\u670d\u52a1\u5668\u56de\u5e94\u3002<\/li>\n\n\n\n<li><strong>\u8bfb\u53d6\u6216\u5199\u5165\u6587\u4ef6\uff1a<\/strong> \u5f53\u7a0b\u5e8f\u5728\u786c\u76d8\u4e0a\u8bfb\u5199\u6587\u4ef6\u65f6\uff0c\u4e5f\u9700\u8981\u7b49\u5f85\u3002<\/li>\n\n\n\n<li><strong>\u67e5\u8be2\u6570\u636e\u5e93\uff1a<\/strong> \u548c\u6570\u636e\u5e93\u901a\u4fe1\uff0c\u7b49\u5f85\u67e5\u8be2\u7ed3\u679c\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u8fd9\u4e9b\u64cd\u4f5c\u90fd\u6709\u4e00\u4e2a\u5171\u540c\u70b9\uff1a\u5b83\u4eec\u5728\u7b49\u5f85\u6570\u636e\u56de\u6765\u7684\u65f6\u5019\uff0cCPU \u5b9e\u9645\u4e0a\u662f\u7a7a\u95f2\u7684\u3002\u5982\u679c\u7528\u4f20\u7edf\u7684\u65b9\u5f0f\uff0c\u7a0b\u5e8f\u5c31\u4f1a\u5728\u90a3\u513f\u5e72\u7b49\u7740\u3002<\/p>\n\n\n\n<p>\u5728 <code class=\"prettyprint\" >asyncio<\/code> \u91cc\uff0c\u5f53\u4f60\u5728\u8fd9\u4e9b\u64cd\u4f5c\u524d\u9762\u52a0\u4e0a <code class=\"prettyprint\" >await<\/code> \u65f6\uff08\u6bd4\u5982 <code class=\"prettyprint\" >await response.text()<\/code> \u6216\u8005 <code class=\"prettyprint\" >await aiofiles.open(&#039;file.txt&#039;).read()<\/code>\uff09\uff0c\u4f60\u7684\u7a0b\u5e8f\u5c31\u4f1a\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u6682\u505c\u5f53\u524d\u4efb\u52a1\u3002<\/strong><\/li>\n\n\n\n<li><strong>\u628a\u63a7\u5236\u6743\u4ea4\u7ed9 <code class=\"prettyprint\" >asyncio<\/code> \u4e8b\u4ef6\u5faa\u73af\u3002<\/strong><\/li>\n\n\n\n<li><strong>\u4e8b\u4ef6\u5faa\u73af\u4f1a\u53bb\u6267\u884c\u5176\u4ed6\u51c6\u5907\u597d\u7684\u4efb\u52a1\u3002<\/strong><\/li>\n\n\n\n<li><strong>\u7b49\u5230\u7f51\u7edc\u6570\u636e\u56de\u6765\u3001\u6587\u4ef6\u8bfb\u5199\u5b8c\u6210\u3001\u6570\u636e\u5e93\u8fd4\u56de\u7ed3\u679c\u65f6\uff0c\u4e8b\u4ef6\u5faa\u73af\u4f1a\u518d\u56de\u5230\u8fd9\u4e2a\u4efb\u52a1\uff0c\u8ba9\u5b83\u7ee7\u7eed\u5f80\u4e0b\u6267\u884c\u3002<\/strong><\/li>\n<\/ol>\n\n\n\n<p>\u8fd9\u6837\uff0c\u4f60\u7684\u7a0b\u5e8f\u5c31\u53ef\u4ee5\u5728\u7b49\u5f85\u4e00\u4e2a\u7f51\u7edc\u8bf7\u6c42\u7684\u540c\u65f6\uff0c\u53bb\u5904\u7406\u53e6\u4e00\u4e2a\u7f51\u7edc\u8bf7\u6c42\uff0c\u6216\u8005\u505a\u5176\u4ed6\u8ba1\u7b97\uff0c\u5927\u5927\u63d0\u9ad8\u4e86\u6548\u7387\u3002\u8fd9\u5c31\u50cf\u4f60\u540c\u65f6\u5f00\u4e86\u597d\u51e0\u4e2a\u8ba2\u5355\uff0c\u4e0d\u9700\u8981\u4e00\u4e2a\u4e00\u4e2a\u5730\u7b49\uff0c\u800c\u662f\u53ef\u4ee5\u540c\u65f6\u5904\u7406\u3002<\/p>\n\n\n\n<p><strong>\u8bb0\u4f4f\uff1a<\/strong> \u5728 <code class=\"prettyprint\" >async<\/code> \u51fd\u6570\u91cc\uff0c\u51e1\u662f\u90a3\u4e9b<strong>\u9700\u8981\u7b49\u5f85\u5916\u90e8\u8d44\u6e90<\/strong>\uff08\u6bd4\u5982\u7f51\u7edc\u3001\u786c\u76d8\u3001\u6570\u636e\u5e93\uff09\u7684\u64cd\u4f5c\uff0c\u6211\u4eec\u90fd\u4f1a\u4f7f\u7528 <strong><code class=\"prettyprint\" >await<\/code><\/strong> \u6765\u914d\u5408\u76f8\u5e94\u7684<strong>\u5f02\u6b65\u5e93<\/strong>\uff08\u6bd4\u5982 <code class=\"prettyprint\" >aiohttp<\/code> \u5904\u7406 HTTP \u8bf7\u6c42\uff0c<code class=\"prettyprint\" >aiofiles<\/code> \u5904\u7406\u6587\u4ef6\uff09\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u521a\u5f00\u59cb\u63a5\u89e6 Python \u91cc\u7684 asyncio \u89c9\u5f97\u6709\u70b9\u513f\u7ed5\u3002\u73b0\u5b66\u73b0\u73b0\u8bb0,\u73b0\u5728\u5c31\u8bb0\u5f55\u4e0b\u5b66\u4e60 asyncio \u65f6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":368,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"class_list":["post-372","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-xuexi"],"_links":{"self":[{"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts\/372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=372"}],"version-history":[{"count":0,"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/posts\/372\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=\/wp\/v2\/media\/368"}],"wp:attachment":[{"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn1.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}