Python Apache日志处理脚本(初稿)

#!/usr/bin/python
#coding=gb2312
res=[];
linx=[];
f=open('/root/access.log.2');
for line in f.readlines():
    line.rstrip();
    log_home=line.split();
    ip=log_home[0];
    date=log_home[3].replace('[','');
    point=log_home[5].replace('"','');
    path=log_home[6];
    offer=log_home[8];
    linx.append(ip);
    linx.append(date);
    linx.append(point);
    linx.append(path);
    linx.append(offer);
    res.append(linx);
f.close();
print res;
原文地址:https://www.cnblogs.com/xiaoCon/p/2942891.html