find if a list of list has items from another list
<p>we have two list, </p>

<pre><code>l=["a","b","c"]
s=[["a","b","c"],
["a","d","c"],
["a-B1","b","c"],
["a","e","c"],
["a_2","c"],
["a","d-2"],
["a-3","b","c-1-1","d"]]
print l 
print s
</code></pre>

<p>Now, I am try to see if each 2nd-level list of <code>s</code> has fuzzy match to any of items in list <code>l</code>. </p>

<pre><code>matches=list() 
matchlist2=list()   
print s2
for i in range(len(s)):
    matches.append([])
    for j in range(len(s[i])):

        for x in l:
            if s[i][j].find(x)&gt;=0:
                print s[i][j]
                matches[i].append(True)

                break
        else:
            matches[i].append(False)


    matchlist2.append(all(x for x in matches[i]))
print matches
print matchlist2
</code></pre>

<p>This gives me what was intended. But I am not happy with how it has so many loops. I am also working with pandas and if there is pandas solution that will be great to. In pandas, there are just two columns of two dataframes. </p>

<pre><code>[[True, True, True], [True, False, True], [True, True, True], [True, False, True], [True, True], [True, False], [True, True, True, False]]
</code></pre>

<p>the second code checks if all items in sublist had match. </p>

<pre><code>[True, False, True, False, True, False, False]
</code></pre>