Sorry for the title, really could not come up with a simple way to explain this situation.
So, if I have one list of strings, for example:
list_1 = [ "cat", "rat", "mat" ]
How can I check that all of these lines are in another list that may have “fluff” around it (I mean, instead of saying “cat”, it might have “cat_mittens”, which would be nice, but "car_mittens" is not.
So for example:
list_A = [ "cat", "car", "cab" ]
list_B = [ "cat", "rat", "bat", "mat" ]
list_C = [ "cat_mittens", "rat", "mat" ]
Here, if I did an analysis on list_A, I would like False to return, for list_BI would need to return True, and for list_C, I would like True to return (since it contains all 3 lines of list A, even if "cat" has extra bits around it (which I called fuzz).
My current approach:
list_1 = [ "cat", "rat", "mat" ]
list_C = [ "cat_mittens", "rat", "mat" ]
temp_list = [False,] * 3
count = 0
for temp_1 in list_1:
temp_list[ count ] = any( temp_1 in temp_2 for temp_2 in list_C )
count += 1
result = all( temp_list )
There is added a complication that in my actual code all the lines in the C list should contain an additional line (for example, everyone would have to say "_filetype"), but this is less of a problem (I do this in the final line) all ").
, , , ( , , , . , , - , ), , .
?
, ! - , .