How would I count the number of occurrences of some value in a multidimensional array made with nested lists? as in, when looking for \'foobar\' in the following list:
>> from collections import Counter
>> counted = Counter([item for sublist in my_list for item in sublist])
>> counted.get('foobar', 'not found!')
>> 2
#or if not found in your counter
>> 'not found!'
This uses flattening of sublists and then using the collections module and Counter to produce the counts of words.