Python Forum
set.difference of two list gives empty result
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
set.difference of two list gives empty result
#5
this diff method can handle duplicates...works well at first sight

from collections import Counter
...
dead_ips = list((Counter(aix_ips) - Counter(aix_reg_list)).elements()) # get list of whats in the first list but not in the second
mission completed
Reply


Messages In This Thread
RE: set.difference of two list gives empty result - by wardancer84 - Jun-14-2022, 01:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  difference between forms of input a list to function akbarza 6 1,160 Feb-21-2024, 08:02 PM
Last Post: bterwijn
  Code with empty list not executing adeana 9 3,815 Dec-11-2023, 08:27 AM
Last Post: buran
  displaying empty list vlearner 5 1,740 Jan-19-2022, 09:12 AM
Last Post: perfringo
  Remove empty keys in a python list python_student 7 3,164 Jan-12-2022, 10:23 PM
Last Post: python_student
  What is the value after JOINING an empty list? JaneTan 2 5,330 Jan-04-2021, 06:25 PM
Last Post: deanhystad
  What is the difference between a generator and a list comprehension? Pedroski55 2 2,281 Jan-02-2021, 04:24 AM
Last Post: Pedroski55
  Printing empty list? hhydration 2 2,160 Oct-28-2020, 11:34 AM
Last Post: Atekka
  Stop a function if the list it needs is empty Pedroski55 2 2,994 Jul-25-2020, 11:50 PM
Last Post: Pedroski55
  Need help to make an empty list with possibility to add Arnsol 1 1,853 Mar-19-2020, 06:08 PM
Last Post: michael1789
  list sum gives unexpected result Nesso 0 1,729 Feb-04-2020, 08:31 AM
Last Post: Nesso

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020