{"id":278679,"date":"2021-01-13T22:03:09","date_gmt":"2021-01-13T14:03:09","guid":{"rendered":"http:\/\/4563.org\/?p=278679"},"modified":"2021-01-13T22:03:09","modified_gmt":"2021-01-13T14:03:09","slug":"%e5%a4%9a%e8%bf%9b%e7%a8%8b%e5%a4%84%e7%90%86%e6%95%b0%e6%8d%ae%e6%97%b6%e5%a6%82%e4%bd%95%e5%ae%8c%e6%95%b4%e6%89%93%e5%8d%b0%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=278679","title":{"rendered":"\u591a\u8fdb\u7a0b\u5904\u7406\u6570\u636e\u65f6\u5982\u4f55\u5b8c\u6574\u6253\u5370\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u591a\u8fdb\u7a0b\u5904\u7406\u6570\u636e\u65f6\u5982\u4f55\u5b8c\u6574\u6253\u5370\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : oldbird <\/span>  <span><i><\/i> 1<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>from multiprocessing import Pool<\/p>\n<p>def do(item):<\/p>\n<pre><code> print item   ...... #\u5904\u7406 txt \uff08\u6bcf\u4e2a\u5927\u6982 5 \u5206\u949f\uff09 <\/code><\/pre>\n<p>if <strong>name<\/strong>==&#8217;<strong>main<\/strong>&#8216;:<\/p>\n<pre><code> items=glob.glob('*.txt')   pool=Pool(5)   pool.map(do,items)   pool.close()   pool.join() <\/code><\/pre>\n<p>items \u4e3a[&#8216;1111.txt&#8217;,&#8217;2222.txt&#8217;,&#8217;3333.txt&#8217;,&#8217;4444.txt&#8217;,&#8217;5555.txt&#8217;,&#8230;&#8230;&#8217;9999.txt&#8217;]<\/p>\n<p>\u8fd0\u884c\u65f6\u4f1a\u7a7f\u63d2\u6253\u5370\uff0c\u6bd4\u5982 111221.33txt<\/p>\n<p>\u662f\u5426\u6709\u529e\u6cd5\u5c06\u6bcf\u9879\u6253\u5370\u5b8c\u6574\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>6<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4928144\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : maocat <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0a\u9501\uff0c\u6539\u540c\u6b65                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4928145\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : crackhopper <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd8\u53ef\u4ee5\u7528 queue\uff0c\u6709\u4e2a\u7ebf\u7a0b\u5b89\u5168\u7684 queue\uff0c\u7528 multiprocessing.Manager\uff0c\u4e0a\u9762\u5e26\u4e86\u4e00\u4e2a queue \u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4928146\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : BrokenVns <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u518d\u542f\u52a8\u4e00\u4e2a\u65e5\u5fd7\u8fdb\u7a0b\uff0c\u901a\u8fc7 socket \u628a\u6bcf\u4e2a\u8fdb\u7a0b\u7684\u65e5\u5fd7\u53d1\u9001\u8fc7\u53bb\uff0c\u7531\u65e5\u5fd7\u8fdb\u7a0b\u6c47\u603b\u6253\u5370\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4928147\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : UN2758 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u7528\u5e26\u961f\u5217\u529f\u80fd\u7684\u65e5\u5fd7,\u6bd4\u5982 loguru                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4928148\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : VYSE <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/github.com\/jruere\/multiprocessing-logging                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4928149\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jones2000 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd8\u4e0d\u5982\u6bcf\u4e2a\u8fdb\u7a0b\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\uff0c \u6bcf\u884c\u65e5\u5fd7\u52a0\u65f6\u95f4\u6233\uff0c\u6700\u540e\u663e\u793a\u7684\u65f6\u5019\u8bfb\u591a\u4e2a\u6587\u4ef6\u65e5\u5fd7\uff0c\u6839\u636e\u65f6\u95f4\u6233\u6392\u5e8f\u4e0b\u3002 \u7701\u4e8b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u591a\u8fdb\u7a0b\u5904\u7406\u6570\u636e\u65f6\u5982\u4f55\u5b8c\u6574\u6253\u5370\uff1f \u8cc7&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\/278679"}],"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=278679"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/278679\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=278679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=278679"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=278679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}