+ 2
How can I check if a value is in a list is inside another list?
For example: [1, 2,3,4,[5,6]]
2 Respuestas
+ 2
HonFu thanks and yes I meant the second option
+ 1
I am not exactly sure if you mean that you want to know, if a list element *is* a list or if you want to know what's *in* the inner list.
If you know where that inner list is exactly in a list called 'list_':
print(5 in list_[4])
Otherwise you'd first have to find that list:
for element in list_:
if type(element) is list:
print(5 in element)