How can I compare two lists in python and return matches.

Posted by tehryan on Stack Overflow See other posts from Stack Overflow or by tehryan
Published on 2009-09-07T11:07:27Z Indexed on 2010/06/16 18:52 UTC
Read the original article Hit count: 113

Filed under:
|
|

I want to take two lists and find the values that appear in both.

a = [1, 2, 3, 4, 5]
b = [9, 8, 7, 6, 5]

returnMatches(a, b)

would return [5], for instance.

© Stack Overflow or respective owner

Related posts about python

Related posts about beginner