[Python] Python通过正则表达式读取tomcat的日志并打印日期 →→→→→进入此内容的聊天室

来自 , 2019-06-03, 写在 Python, 查看 117 次.
URL http://www.code666.cn/view/37f65c06
  1.   import re
  2.      regx = "\d\d\d\d-\d\d-\d+"
  3.      f = open("c:\stdout.log","r")
  4.      i = 0
  5.      for str in f.readlines():
  6.         if re.search(regx,str):
  7.              Response.write(str+"<br>")
  8.               if i>10:break#由于是测试,只分析十行
  9.               i=i+1
  10.      f.close();
  11. #//python/4304

回复 "Python通过正则表达式读取tomcat的日志并打印日期"

这儿你可以回复上面这条便签

captcha