Derived from "Dive Into Python"
list = [[1,2,3],[4,5,6],[7,8,9]]
if 1 in list[0]:
do something
elif 1 in list[1]:
do something
else:
do something
...and so on. The in keyword takes a preceding value argument and returns a true if that value is in the proceeding list, false otherwise. The only other thing to know is list[0] accesses your first element in the top level list (the first sublist) and so on, allowing it to be searched for a specific integer using the in keyword.
Here's the expected output:
>>> list = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
>>> 1 in list[0]
True
>>> 1 in list[1]
False
To search all lists you can use the for keyword to loop over your lists and any to return true if any of the sublists match.
>>> any(1 in sublist for sublist in list)
True
>>> any(42 in sublist for sublist in list)
False