Can I shorten this code into 1-2 lines?
I've tried making it into a list comprehension but I'm not sure how it would work if one of the for loops uses a dictionary key.
for a in dict.keys():
for q in list:
if a in q:
dict[a].append(q)
This code works well to find if the items in the list are one of the dictionary's keys and stores the item as a value under that dictionary key if it is, but I'm hoping to figure out if I can simplify it more.