#!/usr/bin/python#coding:utf-8import rex=open('access1.log')abc={}for i in x: m=re.search('firefox',i) if m: key=m.group() abc[key]=abc.get(key,0)+1print abc