Python Forum
Use one list as search key for another list with sublist of list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use one list as search key for another list with sublist of list
#3
Thank you for your time and answer Smile
I wanted to go further and then compare the first item of the vector's list only so I tried the code bellow but I get a TypeError:

S = set(tuple(x[1]) for x in list1[0])
result = [x for x in list2[0] if tuple(x[1]) not in S]
Reply


Messages In This Thread
RE: Use one list as search key for another list with sublist of list - by jc4d - Jan-10-2022, 09:19 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  List with equal repeatable data Ataman 6 269 Jun-13-2024, 07:30 PM
Last Post: Ataman
  Downloading Page Source From URL List zunebuggy 11 479 Jun-08-2024, 06:40 AM
Last Post: Pedroski55
  how to capitalize letter in list object Python iwonkawa 4 279 May-29-2024, 04:29 PM
Last Post: DeaD_EyE
  remove duplicates from dicts with list values wardancer84 27 1,041 May-27-2024, 04:54 PM
Last Post: wardancer84
  what to return for an empty list Skaperen 2 295 May-24-2024, 05:17 PM
Last Post: Skaperen
  Extending list doesn't work as expected mmhmjanssen 2 350 May-09-2024, 05:39 PM
Last Post: Pedroski55
  Strange behavior list of list mmhmjanssen 3 506 May-09-2024, 11:32 AM
Last Post: mmhmjanssen
  Sort a list of dictionaries by the only dictionary key Calab 2 762 Apr-29-2024, 04:38 PM
Last Post: Calab
  element in list detection problem jacksfrustration 5 649 Apr-11-2024, 05:44 PM
Last Post: deanhystad
  Why is the copy method name in python list copy and not `__copy__`? YouHoGeon 2 407 Apr-04-2024, 01:18 AM
Last Post: YouHoGeon

Forum Jump:

User Panel Messages

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