[Tutor] Help

Alan Gauld alan.gauld at btinternet.com
Tue Jan 26 19:44:56 EST 2016


On 26/01/16 20:57, Chelsea G wrote:
> ...I have the basic code for it...

Sorry, when I said paste it in the message I should have
also pointed out that you need to ensure the mail tool
is sending plain text, otherwise we lose all indentation.

But this looks like the same code as before so I'm
guessing you haven't fixed those issues I raised
last time?

Alan G.

> import csv
> import json
> import sys
> from collections import defaultdict
> from collections import Counter
> 
> 
> class dictionary():
> def __init__(self):
> self.dict = defaultdict(list)
> self.counted_dict = defaultdict(list)
> self.grouped_dict = defaultdict(list)
> self.other_dict = defaultdict(list)
> self.final_dict = defaultdict(list)
> self.total_dict = defaultdict(list)
> self.search_dict = defaultdict(list)
> mydict = defaultdict(list)
> def populate_dict(self, filename):
> with open (filename, 'rb') as f:
> reader = csv.reader(f)
> next(reader, None)
> for row in reader:
> self.dict[row[2]].append(row[3])
...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list