Mark, Visit the following URL link to view a captured copy of the latest code revision, available at http://tinyurl.com/nvzdw8k
Regards, Hal On Thu, Aug 6, 2015 at 10:17 AM, Ltc Hotspot <ltc.hots...@gmail.com> wrote: > > > On Thu, Aug 6, 2015 at 8:28 AM, Mark Lawrence <breamore...@yahoo.co.uk> > wrote: > >> On 06/08/2015 05:22, Ltc Hotspot wrote: >> >> Please don't top post here, it makes following long threads difficult. >> >> Mark, >>> >>> Replace count[address]= count.get(address,0) +1 with c = >>> Counter(['address'])? >>> >> >> Try it at the interactive prompt and see what happens. >> >> How do I define counter,view trace back: >> >> NameError >> Traceback (most recent call last) >> C:\Users\vm\Desktop\apps\docs\Python\new.txt in <module>() >> 1 fname = raw_input("Enter file name: ") >> 2 handle = open (fname, 'r') >> ----> 3 c = Counter(['address']) >> 4 >> 5 >> > NameError: name 'Counter' is not defined > > > View revised code here: > > fname = raw_input("Enter file name: ") > handle = open (fname, 'r') > c = Counter(['address']) > > count = dict () > maxval = None > maxkee = None > > for kee, val in count.items(): > maxval = val > maxkee = kee > > for line in handle: > if line.startswith("From: "): > address = line.split()[1] > count[address]= count.get(address,0) +1 > print maxkee and maxval > > > In [20]: > Hal > >> >>> >>> >>> >>>> _______________________________________________ >> Tutor maillist - Tutor@python.org >> To unsubscribe or change subscription options: >> https://mail.python.org/mailman/listinfo/tutor >> > > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor