{"id":184776,"date":"2020-10-26T14:49:43","date_gmt":"2020-10-26T06:49:43","guid":{"rendered":"http:\/\/4563.org\/?p=184776"},"modified":"2020-10-26T14:49:43","modified_gmt":"2020-10-26T06:49:43","slug":"python-%e5%8d%8f%e7%a8%8b%e9%87%8c-for-%e5%be%88%e9%95%bf%e7%9a%84-list-%e4%bc%9a%e9%98%bb%e5%a1%9e%e5%90%97","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=184776","title":{"rendered":"Python \u534f\u7a0b\u91cc for \u5f88\u957f\u7684 list \u4f1a\u963b\u585e\u5417?"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Python \u534f\u7a0b\u91cc for \u5f88\u957f\u7684 list \u4f1a\u963b\u585e\u5417?               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Te11UA <\/span>  <span><i><\/i> 2<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u7531\u4e8e\u770b\u5230\u6709 `async for` \u548c `for await `\uff0c\u6240\u4ee5\u4e0d\u6e05\u695a\u5982\u679c task_list \u662f\u4e00\u4e2a\u6bd4\u8f83\u957f\u7684 list \u662f\u5426\u4f1a\u963b\u585e\u5462\uff1f\u627e\u4e86\u4e00\u5708\u8c37\u6b4c\u6ca1\u6709\u8bf4\u5230\u8fd9\u4e2a\u7684&#8230;<\/p>\n<p>&#8220;`python<br \/>async def func():<br \/>____task_list = list()<br \/>____for task in tasks.task_list:<br \/>________status= await redis_client.get(f&#8217;task:{task}&#8217;)<br \/>&#8220;`      <\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>2<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3979638\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : fasionchan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u4f1a\uff0c\u5982\u679c\u5b50\u4efb\u52a1\u963b\u585e\u7684\u8bdd\uff0cawait \u4f1a\u8ba9\u51fa\u6267\u884c\u6743                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3979639\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : black11black <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53d6\u51b3\u4e8e\u4f60\u8c03\u7528\u65b9\u6cd5\u5185\u90e8\u662f\u5426\u6709\u628a\u63a7\u5236\u6743\u8fd4\u56de\u7684\u547d\u4ee4\u3002\u4e00\u4e2a\u5f02\u6b65\u51fd\u6570\uff0c\u5185\u90e8\u5982\u679c\u6ca1\u6709\u4efb\u4f55\u5f02\u6b65\u8c03\u7528\uff0c\u8fc7\u7a0b\u4e2d\u5373\u4f7f await \u4e5f\u662f\u4e0d\u4f1a\u5411 eventloop \u8fd4\u56de\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4\u6267\u884c\u65f6\u963b\u585e\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Python \u534f\u7a0b\u91cc for \u5f88\u957f&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/184776"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=184776"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/184776\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=184776"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=184776"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=184776"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}