I have a dictionary that has a place name as a key and as the value it has several lists of words, eg, 1 entry looks like:
{'myPlaceName': [u'silly', u'i', u'wish!', u'lol', [u'the', u'lotto'], [, u'me', u'a', u'baby?'], [u'new', u'have', u'new', u'silly', u'new', u'today,', u'cant', u'tell', u'yet,', u'but', u'all', u'guesses', u'silly']]}
How can I join them all so I can get the common words associated with each place?
I would like my output to get silly and new as the common words for the dictionary.
This function takes a list of a list of words, and returns all words that are found in all the lists.
eg
get_common_words([['hi', 'hello'], ['bye', 'hi']])returns['hi']or the giant one-liner:
or just go with one of the methods suggested in the comments of this answer.