[Tutor] Dictionary - count values where values are stored as a list

Kent Johnson kent37 at tds.net
Mon Oct 1 18:32:54 CEST 2007

GTXY20 wrote:
> This works perfectly.
> However I will be dealing with an import of a very large dictionary - if 
> I call the commands at command line this seems to be very taxing on the 
> CPU and memory and will take a long time.
> I was thinking of creating each as a fucntion whereby python would just 
> to write to a file instead of calling within a python shell do you think 
> that this would speed up the process?

I don't understand what you are suggesting.

Both of your requirements just need the values of the dict. If the dict 
is being created from a file, you could probably build the count dicts 
on the fly as you read the values without ever creating the dict with 
all the items in it.


> All in total I will probably be looking at about 2 million dictionary 
> keys with assorted value quantities.

More information about the Tutor mailing list