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

GTXY20 gtxy20 at gmail.com
Mon Oct 1 07:35:02 CEST 2007


Hello,

Any way to display the count of the values in a dictionary where the values
are stored as a list? here is my dictionary:

 {'1': ['a', 'b', 'c'], '3': ['a', 'b', 'c'], '2': ['a', 'b', 'c'], '4':
['a', 'c']}

I would like to display count as follows and I would not know all the value
types in the values list:

Value QTY
a       4
b       3
c       4

Also is there anyway to display the count of the values list combinations so
here again is my dictionary:
{'1': ['a', 'b', 'c'], '3': ['a', 'b', 'c'], '2': ['a', 'b', 'c'], '4':
['a', 'c']}


And I would like to display as follows

QTY Value List Combination
3      a,b,c
1      a,c

Once again all help is much appreciated.

M.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071001/13e41d51/attachment.htm 


More information about the Tutor mailing list