标签:proc coding img bcb open data for /usr httpd
#!/usr/bin/python#!/usr/bin/python
#coding:utf-8
import re
dic={}
data=open(‘/var/log/httpd/access_log‘)
for i in data:
m = re.search(‘(Firefox|chrome)‘,i)
if m:
key=m.group()
dic[key]=dic.get(key,0)+1
print dic
#!/usr/bin/python
#coding:utf-8
import re
dic={}
data=open(‘/var/log/httpd/access_log‘)
for i in data:
m = re.search(‘(\d+.){3}\d+‘,i)
if m:
key=m.group()
dic[key]=dic.get(key,0)+1
print dic
标签:proc coding img bcb open data for /usr httpd
原文地址:http://blog.51cto.com/13587189/2070662