I have this code here
import string
def count_and_sort( ):
filer = {}
f = open("loggfil.t xt","r")
f2 = open("lab5.out" ,"w")
person = "lisa.sm.luth.s e"
while True:
rad = f.readline()
split = string.split(ra d)
if rad == "":
f.close()
break
elif person in rad:
split2 = split[6]
filer[split2] = filer.get(split 2,0) + 1
keys = filer.keys()
keys.sort()
for lines in keys:
f2.write(lines+ "\n")
f.close()
this code prints out this from a log file
//csee/csn/include/div.cfg
/csee/csn//include/address.html
/csee/csn//include/footmenu.html
/csee/csn//include/links.html
/csee/csn/presentation.ht ml
/csee/csn/research.html
I want it to display on the side of the filename how many times you downloaded it. I put everything in a dictionary but i can only get the keys. How do i get the values. Thanks in advance
import string
def count_and_sort( ):
filer = {}
f = open("loggfil.t xt","r")
f2 = open("lab5.out" ,"w")
person = "lisa.sm.luth.s e"
while True:
rad = f.readline()
split = string.split(ra d)
if rad == "":
f.close()
break
elif person in rad:
split2 = split[6]
filer[split2] = filer.get(split 2,0) + 1
keys = filer.keys()
keys.sort()
for lines in keys:
f2.write(lines+ "\n")
f.close()
this code prints out this from a log file
//csee/csn/include/div.cfg
/csee/csn//include/address.html
/csee/csn//include/footmenu.html
/csee/csn//include/links.html
/csee/csn/presentation.ht ml
/csee/csn/research.html
I want it to display on the side of the filename how many times you downloaded it. I put everything in a dictionary but i can only get the keys. How do i get the values. Thanks in advance
Comment