我的日志文件在下面。需要找到在2018-07-11 10和2018-07-11 11之间运行的线路
2018-07-11 10:12:06 12.115.14.240 "PUT /apng/assembler-2.0/assembler2.php HTTP/1.1" 403 231 "http://littlesvr.ca/apng/history.html"
2018-07-11 10:15:06 202.167.250.99 "GET /apng/images/o_sample.png?142475198 HTTP/1.1" 403 115656 "http://bbs.mydigit.cn/read.php"
2018-07-11 11:16:06 120.115.144.240 "GET /apng/assembler-2.0/assembler2.php HTTP/1.1" 200 231 "http://littlesvr.ca/apng/history.html"
with open(log) as f:
log = f.read()
###if condition to show to get GET
line = re.search(rx,log)
期望输出
2018-07-11 10:15:06 202.167.250.99 "GET /apng/images/o_sample.png?142475198 HTTP/1.1" 403 115656 "http://bbs.mydigit.cn/read.php"
我认为正则表达式会起作用:
相关问题 更多 >
编程相关推荐