Possible Duplicate:
Get difference from 2 lists. Python
I have two lists
rt = [1,2,3]
dp = [1,2]
What is the most pythonic way to find out that in the rt list that 3 is not a element of the dp list?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use sets:
Or a list comprehension:
EDIT: jamylak pointed out you could use a set to improve the efficiency of membership lookup: