[Python] python分析apache和nginx日志文件输出访客ip列表 →→→→→进入此内容的聊天室

来自 , 2019-12-02, 写在 Python, 查看 105 次.
URL http://www.code666.cn/view/5747a002
  1. ips = {}
  2.  
  3. fh = open("/var/log/nginx/access.log", "r").readlines()
  4. for line in fh:
  5.     ip = line.split(" ")[0]
  6.     if 6 < len(ip) <=15:
  7.         ips[ip] = ips.get(ip, 0) + 1
  8. print ips

回复 "python分析apache和nginx日志文件输出访客ip列表"

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

captcha