0

is there any function to check if the content of a list are present in another list?

11th Sep 2020, 10:35 AM
Jeet Swarnakar
Jeet Swarnakar - avatar
2 Answers
+ 5
The procedure to get this task done, can be different, depending on the structure of the list. If you have a flat list you can search like Slick mentioned. If you have a list of strings, or list of list (nested lists), you also need to use a nested for loop to get the result. Jeet Swarnakar , could you please give us a sample of your input list, and also the sub-list to search for? Thanks!
11th Sep 2020, 11:10 AM
Lothar
Lothar - avatar
0
usually the "in" operator works fine. as in: if sublist in list: print("Yup, it's in there.")
11th Sep 2020, 10:52 AM
Slick
Slick - avatar