{"id":545829,"date":"2021-11-14T12:42:48","date_gmt":"2021-11-14T04:42:48","guid":{"rendered":"http:\/\/4563.org\/?p=545829"},"modified":"2021-11-14T12:42:48","modified_gmt":"2021-11-14T04:42:48","slug":"%e5%b7%b2%e8%a7%a3%e5%86%b3-%e6%95%99python%e5%a4%a7%e4%bd%ac%ef%bc%8c%e5%a6%82%e4%bd%95%e6%8a%8a%e6%95%b0%e7%bb%84%e4%b8%8e%e4%b8%80%e4%b8%aatxt%e6%96%87%e6%a1%a3%e5%8c%b9%e9%85%8d","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=545829","title":{"rendered":"\u5df2\u89e3\u51b3-\u6559python\u5927\u4f6c\uff0c\u5982\u4f55\u628a\u201c\u6570\u7ec4\u201d\u4e0e\u4e00\u4e2atxt\u6587\u6863\u5339\u914d\u6570\u636e"},"content":{"rendered":"\n<p>  \t\t\t\t\t<strong>\u6218\u795e\u8d75\u65e5\u5929<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3>\u5df2\u89e3\u51b3-\u6559python\u5927\u4f6c\uff0c\u5982\u4f55\u628a\u201c\u6570\u7ec4\u201d\u4e0e\u4e00\u4e2atxt\u6587\u6863\u5339\u914d\u6570\u636e<\/h3>\n<p>  \t\t \u672c\u5e16\u6700\u540e\u7531 \u6218\u795e\u8d75\u65e5\u5929 \u4e8e 2021-11-14 11:43 \u7f16\u8f91 <\/p>\n<p> \u8fd9\u662f\u521d\u5b66\u8005\u5c0f\u5f1f\u4eca\u5929\u7b2c\u4e8c\u6b21\u53d1python\u8bf7\u6559\u8d34\uff0c\u7279\u522b\u611f\u8c22 @Floppy @sRGB @Ausxilia \u5728\u4e0a\u4e00\u4e2a\u8d34\u4e2d\u7ed9\u4e88\u5c0f\u5f1f\u7684\u6307\u70b9\u548c\u5e2e\u52a9https:\/\/hostloc.com\/thread-917967-1-1.html<\/p>\n<p>  \u73b0\u5728\u6570\u7ec4\u662f\u63d0\u53d6\u51fa\u6765\u4e86s = [&#8216;aa&#8217;,&#8217;ab&#8217;,&#8217;ac&#8217;,&#8217;ad&#8217;,&#8217;ae&#8217;,&#8217;af&#8217;]<\/p>\n<p>  \u60f3\u8981\u770b\u4e00\u4e0bs\u6570\u7ec4\u5728x.txt\u8fd9\u4e2a\u6587\u672c\u4e2d\u662f\u5426\u6709\u5339\u914d\u7684\u6570\u636e<br \/>  x.txt\u53ef\u4ee5\u662f&nbsp; &nbsp;ef,ki,ad,lo,yh,nm\u8fd9\u79cd\u9017\u53f7\u9694\u5f00<br \/>  x.txt\u4e5f\u53ef\u4ee5\u662f&nbsp; &nbsp;<br \/>  ef<br \/>  ki<br \/>  ad<br \/>  lo<br \/>  yh<br \/>  nm<br \/>  \u8fd9\u79cd\u6309\u884c\u6392\u5e8f<\/p>\n<p>  \u53ea\u8981\u67e5\u8be2\u5230s\u6570\u7ec4\u6709\u4efb\u4f55\u4e00\u4e2a\u6570\u636e\uff0c\u6bd4\u5982ad\u5728x.txt\u4e2d\u51fa\u73b0<br \/>  \u5219\u8fd4\u56deture\uff0c\u5426\u5219\u5219flase<\/p>\n<p>  \u6709\u6ca1\u6709\u540a\u5927\u7684mjj\u6765\u8ba8\u8bba\uff0c\u6307\u70b9\u5c0f\u5f1f\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>518<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tdef match_file(s, file_name):<br \/>  &nbsp; &nbsp; with open(file_name, &quot;r&quot;) as f:<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;t = re.split(r'[,n]&#8217;, f.read())<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;if any(i in t for i in s):<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;return True<br \/>  &nbsp; &nbsp;&nbsp; &nbsp;return False\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>Ausxilia<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u6211\u7528\u6700\u7b80\u5355\u7c97\u66b4\u7684\u5224\u65ad\uff0c\u5c31\u662f<br \/>  data= f.read()<br \/>  if item in data<\/p>\n<p>  \u5b57\u7b26\u4e32\u53ef\u4ee5\u76f4\u63a5\u67e5\u627e\u662f\u5426\u5728\u6587\u4ef6\u7684\u5b57\u7b26\u4e32\u4e2d\u5b58\u5728<br \/>  \u5f53\u7136\u8fd9\u4e2a\u9700\u8981\u5b57\u7b26\u4e32\u7684\u8fa8\u8bc6\u5ea6\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u76ef\u88c6\u732b<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u628atxt\u8bfb\u53d6\u51fa\u6765\u5c31\u884c\u4e86\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u6218\u795e\u8d75\u65e5\u5929<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tAusxilia \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-11-14 11:13<br \/>  \u6211\u7528\u6700\u7b80\u5355\u7c97\u66b4\u7684\u5224\u65ad\uff0c\u5c31\u662f<br \/>  data= f.read()<br \/>  if item in data<\/p>\n<p> \u6210\u529f\u9a97\u51fa\u5927\u4f6c\uff0c\u6069\uff0c\u6211\u8bd5\u8bd5\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u771f\u5185\u5b58<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u611f\u89c9Python\u5927\u4f6c\u5f88\u591a\u554a\uff0c\uff0c\uff0c\u53ef\u4ee5\u5f00\u4e2aPython\u677f\u5757\u4e86:lol\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>wenguonideshou<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t\u770b\u8d77\u6765\u662f\u591a\u5bf9\u591a\u5339\u914d\u7684\u95ee\u9898\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>\u6218\u795e\u8d75\u65e5\u5929<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\t518 \u5927\u4f6c\u6709\u8bdd\u8bf4 : 2021-11-14 11:23<\/p>\n<p> \u5927\u4f6c\u8fd9\u4e2a\u66f4\u725b\u903c\uff0c\u7ed9\u5c0f\u5f1f\u6dfb\u7816\u52a0\u74e6\u4e86\uff0c\u5c5e\u4e8e\u662f<br \/>  \u591a\u8c22\u591a\u8c22\t\t\t\t<\/p>\n<p>  \t\t\t\t\t<strong>xiaohu<\/strong>  \t\t\t\t\u5927\u4f6c\u6709\u8bdd\u8bf4 : \t<\/p>\n<h3><\/h3>\n<p>  \t\tfindall\t\t\t  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6218\u795e\u8d75\u65e5\u5929 \u5927\u4f6c\u6709\u8bdd\u8bf4 : \u5df2\u89e3\u51b3&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/545829"}],"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=545829"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/545829\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=545829"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=545829"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=545829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}