Say if I have:
list1 = [1,6]
list2 = [1]
I want to do something if list values match!
Compare it and do stuff after that
Mmm, like this?
if list1 == list2: # compare lists for equality
    doStuff()      # if lists are equal, do stuff after that   
Of course, you need to clarify what do you mean by "if lists values match". The above will check to see if both lists have the same elements, in the same position - that is, if they're equal.
EDIT:
The question is not clear, let's see some possible interpretations. To check if all elements in list1 are also in list2 do this:
if all(x in list2 for x in list1):
    doStuff()
Or to do something with each element in list1 that also belongs in list2, do this:
for e in set(list1) & set(list2):
    doStuff(e)
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With