{"id":149328,"date":"2020-08-22T05:41:47","date_gmt":"2020-08-21T21:41:47","guid":{"rendered":"http:\/\/4563.org\/?p=149328"},"modified":"2020-08-22T05:41:47","modified_gmt":"2020-08-21T21:41:47","slug":"%e6%83%b3%e8%a6%81%e8%af%bb%e5%8f%96%e4%b8%80%e4%b8%aa%e6%96%87%e4%bb%b6%e5%b9%b6%e7%ad%9b%e9%80%89%e7%89%b9%e5%ae%9a%e7%9a%84%e6%96%87%e4%bb%b6%e5%90%8d%e8%af%a5%e6%80%8e%e4%b9%88%e5%81%9a%e5%91%a2","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=149328","title":{"rendered":"\u60f3\u8981\u8bfb\u53d6\u4e00\u4e2a\u6587\u4ef6\u5e76\u7b5b\u9009\u7279\u5b9a\u7684\u6587\u4ef6\u540d\u8be5\u600e\u4e48\u505a\u5462"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u60f3\u8981\u8bfb\u53d6\u4e00\u4e2a\u6587\u4ef6\u5e76\u7b5b\u9009\u7279\u5b9a\u7684\u6587\u4ef6\u540d\u8be5\u600e\u4e48\u505a\u5462               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jeblur <\/span>  <span><i><\/i> 6<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>Very Very New to Python&#8230; \u6211\u7684\u60f3\u6cd5\u662f\u5148 with open \u6253\u5f00\u6587\u4ef6\uff0c\u7136\u540e\u8bfb\u6bcf\u884c\u7684\u5185\u5bb9\uff0c\u5e76\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u7b5b\u9009\u7279\u5b9a\u7684\u5185\u5bb9\u3002<\/p>\n<p>\u4f46\u67e5\u4e86\u5f88\u591a\u4ee3\u7801\u597d\u50cf\u90fd\u6ca1\u80fd\u505a\u6210<\/p>\n<pre><code>import re import os import sys  stringToMatch = '[^\/]*.js' matchedLine = ''  with open('access_log.txt') as f:         for line in f:                 if stringToMatch in line:                         print line <\/code><\/pre>\n<p>\u4e0a\u9762\u662f\u5176\u4e2d\u4e00\u4e2a\u3002\u3002 \u8fd0\u884c\u540e\u5b8c\u5168\u6ca1\u6709\u8f93\u51fa[\u4e00\u8138\u61f5]<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3115876\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : imn1 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             stringToMatch = r'[^\/]+.js&#8217;<br \/>&#8230;<br \/>if re.search(stringToMatch, line):<br \/>&#8230;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3115877\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : jeblur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @imn1 \u592a\u611f\u8c22\u4e86\uff01\u53ef\u4ee5\u8f93\u51fa line \u4e86\uff0c\u8fd8\u60f3\u95ee\u4e0b\u5982\u679c\u8981\u5339\u914d\u7279\u5b9a\u7684\u503c\uff0c\u6bd4\u5982\u4ee3\u7801\u4e2d\u7684*.js \u6587\u4ef6\uff0c\u8981\u6362\u6389 search \u8fd9\u4e2a\u65b9\u6cd5\u5417\u3002\u5173\u4e8e\u8fd9\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u6211\u80fd\u7406\u89e3\u7684\u662f\u5339\u914d\u5230\u7b2c\u4e00\u4e2a \/\u5f00\u59cb\u7136\u540e\u4ee5.js \u7ed3\u5c3e\uff0c\u6700\u540e\u6211\u9700\u8981\u52a0$\u7ed3\u675f\u5417\u3002<\/p>\n<p>\u62b1\u6b49\u95ee\u4e86\u8fd9\u4e48\u591a\u95ee\u9898:&gt;                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3115878\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : imn1 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u7406\u89e3\u9519\u4e86<br \/>\u8fd9\u4e2a\u6b63\u5219\u662f \u4e00\u4e2a\u6216\u591a\u4e2a\u4e0d\u662f\u201c\/\u201d\u7684\u5b57\u7b26\u540e\u9762\u7d27\u63a5.js \uff0c\u5728\u4e00\u884c\u91cc\u9762\u7684\u4efb\u610f\u4f4d\u7f6e\uff0c\u6ca1\u6709\u65b9\u62ec\u53f7\u7684^\u624d\u662f\u884c\u9996<br \/>\u5982\u679c\u4f60\u786e\u5b9a\u5339\u914d\u7ed3\u5c3e\u662f.js \u624d\u7528$\uff0c\u5982\u679c\u5728\u884c\u4e2d\u95f4\u5c31\u4e0d\u9700\u8981\uff08 line \u6700\u540e\u5e94\u8be5\u662f\u4e2a\u6362\u884c\u7b26\uff0c\u4e0d\u8fc7\u4f60\u53ef\u4ee5\u6d4b\u8bd5\u4e00\u4e0b\u80fd\u5426\u5339\u914d\uff09<br \/>re \u91cc\u9762\u6709\u5f88\u591a\u5339\u914d\u7684\u65b9\u6cd5\uff0c\u53ea\u662f\u8fd9\u4e2a search \u7528\u4e8e\u201c\u662f\u5426\u5339\u914d\u201d\u6bd4\u8f83\u7b80\u5355\uff0c\u6839\u636e\u9700\u8981\u4f60\u53ef\u4ee5\u7528\u5176\u4ed6\u7684<\/p>\n<p>\u4f60\u9700\u8981\u5b66\u4e60\u6b63\u5219\uff0c\u4ee5\u53ca re \u7684\u65b9\u6cd5                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u60f3\u8981\u8bfb\u53d6\u4e00\u4e2a\u6587\u4ef6\u5e76\u7b5b\u9009\u7279\u5b9a\u7684\u6587\u4ef6\u540d&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\/149328"}],"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=149328"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/149328\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=149328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=149328"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=149328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}