Search Results

Search found 1 results on 1 pages for 'eladc'.

Page 1/1 | 1 

  • How to compare two lists with duplicated items in one list?

    - by eladc
    I need to compare list_a against many others. my problem starts when there's a duplicated item in the other lists (two k's in other_b). my goal is to filter out all the lists with the same items (up to three matching items). list_a = ['j','k','a','7'] other_b = ['k', 'j', 'k', 'q'] other_c = ['k','k','9','k'] >>>filter(lambda x: not x in list_a,other_b) ['q'] I need a way that would return ['k', 'q'], because 'k' appears only once in list_a. comparing list_a and other_c with set() isn't good for my purpose since it will return only one element: k. while I need ['k','9','k'] I hope I was clear enough. Thank you

    Read the article

1