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
#1
Hello,

I have two lists that returns some vector values with it's own name:
list1 = [['orange', [1, 2, 3]]]
list2 = [['apple', [1, 2, 3]], ['banana', [1, 2, 3]], ['pear', [-1, 2, 3]], ['kiwi', [-1, -2, 3]]].

I would need to use the list1 as a "search key" and ignoring the string on the list2 and print out the sublist that are not the same than in list1, which in theory should be:
newlist = [['pear' [-1, 2, 3], ['kiwi', [-1, -2, 3]]]

Could anyone give me a light on this?
Reply


Messages In This Thread
Use one list as search key for another list with sublist of list - by jc4d - Nov-30-2021, 08:45 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Extending list doesn't work as expected mmhmjanssen 2 230 May-09-2024, 05:39 PM
Last Post: Pedroski55
  Strange behavior list of list mmhmjanssen 3 383 May-09-2024, 11:32 AM
Last Post: mmhmjanssen
  Sort a list of dictionaries by the only dictionary key Calab 2 685 Apr-29-2024, 04:38 PM
Last Post: Calab
  element in list detection problem jacksfrustration 5 526 Apr-11-2024, 05:44 PM
Last Post: deanhystad
  Why is the copy method name in python list copy and not `__copy__`? YouHoGeon 2 331 Apr-04-2024, 01:18 AM
Last Post: YouHoGeon
  PyYAML read list of int zisco 2 388 Apr-02-2024, 12:36 PM
Last Post: zisco
  How to parse and group hierarchical list items from an unindented string in Python? ann23fr 0 244 Mar-27-2024, 01:16 PM
Last Post: ann23fr
  list.sort() returning None SmallCoder14 8 711 Mar-19-2024, 09:49 PM
Last Post: SmallCoder14
  append str to list in dataclass flash77 6 636 Mar-14-2024, 06:26 PM
Last Post: flash77
  Help with to check an Input list data with a data read from an external source sacharyya 3 507 Mar-09-2024, 12:33 PM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

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