Hi, I have a function that returns something like this;
[[[1, 5, 9], [2, 6, 7], [3, 4, 8]], [[1, 6, 8], [2, 4, 9], [3, 5, 7]]] It is a list of list of lists. Each uppermost list is called a result. I want to write a code that shows that each elem in sublists of result on appears once in whole sublist in order to add it to my doctest. I am looking for something like this; for result in results: print sum(1 for group in result for item in group) [1, 1, 1, 1, 1, 1, 1, 1, 1] [1, 1, 1, 1, 1, 1, 1, 1, 1] Above code gives me 9,9. but I want the example output above. I prefer a one liner because this is supposed to go into a doctest. -- http://ysar.net/ -- https://mail.python.org/mailman/listinfo/python-list