# How do you compare 2 lists and return the difference? (difference function in python does not return what I need)

 Topweasel HOME ยป Programming Languages

I am trying to find the difference between 2 lists. Basically, I want to know everything that is in list 1 that is not in list 2. The best way to explain it, is with an example:

```List1 = [a, a, b, c, d, e]List2 = [a, b, c, d]In this example, I would like a function that would return [a, e]```

When I use the difference function in python, it will only return "e" and not that there is an additional "a" that is in list 1. When I simply used XOR between the 2 lists, it also only returned "e." Thanks!

 Related to : How do you compare 2 lists and return the difference? (difference function in python does not return what I need) How do you compare 2 lists and return the difference? (difference function in python does not return what I need) by Topweasel in Programming Languages I am trying to find the difference between 2 lists. Basically, I want to know everything that is in list 1 that is not in list 2. The best way to explain it, is with an example:```List1 = [a, a, b, c, d, e]List2 = [a, b, c, d]In this example, I would like a function that TAGS: compare lists return difference difference function ``` How can I compare two lists in python and return matches by Boyer C. in Programming Languages 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. TAGS: compare lists python return matches Compare Two Numbers and Return Difference by pmaiorana in Programming Languages Compare Two Numbers and Return Difference HiI need to compare the value of two controls on my form and return the difference between them. Both controls will contain a number in currency format with two decimal places. A third control with the same format settings TAGS: Compare Numbers Return Difference python: compare two lists and return matches in order 28/11/2014 2:30 pm by malbojah in Programming Languages I have two lists of unequal length and I would like to compare and pull matched values ``````a = ['a','s','d','f'] b = ['e','d','y','a','t','v'] `````` expected output: ``````['a','d'] `````` I was doing it like this but I forgot that set doesnt retain th TAGS: python compare lists return matches order Jquery - Compare 2 arrays - return difference by Mytime34 in Programming Languages What's the fastest / best way to compare two arrays and return the difference? Much like `array_diff` in PHP. Is there an easy function or am I going to have to create one via each()? or a foreach loop? TAGS: Jquery Compare arrays return difference Compare two batches of text and return difference by Nick Durcholz in Programming Languages Hi, Im trying to figure out a way to compare two versions of the same text file from a database and to highlight the changes when viewing the text? Can anyone help me with this? TAGS: Compare batches text return difference compare two lists in python and return indices of matched values by enginecrew in Programming Languages For two lists a and b, how can I get the indices of values that appear in both? For example,```a = [1, 2, 3, 4, 5]b = [9, 7, 6, 5, 1, 0]return_indices_of_a(a, b)```would return `[0,4]`, with ```(a[0],a[4]) = (1,5)```. TAGS: compare lists python return indices matched compare data in query to field in table return difference by J.W. Mosley in Programming Languages Hello to all...Please if anyone can help with this.Have table "Staff" and table "StaffHrs" which is populated by user entry. Have query "StaffHrs report" to generate report from StaffHrs table. This is what I'm trying to do: When "StaffHrs TAGS: compare data query field table return Function Return, IE/Mozilla Difference by ertuzio in Programming Languages The Issue: The alert in setUp works and displays correctly in IE (upon reloading...). Why not firefox? Also....it only works when you reload?? Obviously missing something here. Code: ```/** Create Associ TAGS: Function Return Mozilla Difference ``` Casting difference between 8.2 and 8.4 on function return value by cyclohexane in Programming Languages Hello,I'm testing version 8.4 for possible upgrade from 8.2.6. When testing our software, I noticed that there is difference between casting.Our function returns '3' or '1' as text and it is working at 8.2.6, but not at 8.4. TAGS: Casting difference between function return value

HD Wallpapers
 3D 3D Abstract City Celebrities Indian Celebrities Cars Travel Girls Animals Birds Movies Sports Black White Nature Planes Anime Food Drink Dreamy Fantasy Architecture Games Space Holidays Flowers Love Artistic Baby Beach Bikes Motorcycles Macro Computers Vector Funny Army Textures Brands Misc Music Other