Python Forum
Сheck if an element from a list is in another list that contains a namedtuple
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Сheck if an element from a list is in another list that contains a namedtuple
#1
Hello, i have this code:

def some_generator(some_args):
    Import = namedtuple("Import", ["module", "name", "alias"]) # "module", "name" and "alias" can be listed
...
    for n in node.names:
        yield Import(module, n.name.split('.'), n.asname)
...
files = list()
requirements = list()
...
for member in members:
    files.append(member)
...
for requirement in self.some_generator(some_args):
    requirements.append(requirement)
...
and then i need to check if an element from "files" is in "requirements" (module, name or alias)
how to implement it?
Reply


Messages In This Thread
Сheck if an element from a list is in another list that contains a namedtuple - by elnk - Oct-25-2022, 04:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Strange behavior list of list mmhmjanssen 2 238 May-01-2024, 07:16 AM
Last Post: Gribouillis
  element in list detection problem jacksfrustration 5 450 Apr-11-2024, 05:44 PM
Last Post: deanhystad
  list in dicitonary element problem jacksfrustration 3 761 Oct-14-2023, 03:37 PM
Last Post: deanhystad
  No matter what I do I get back "List indices must be integers or slices, not list" Radical 4 1,241 Sep-24-2023, 05:03 AM
Last Post: deanhystad
  Delete strings from a list to create a new only number list Dvdscot 8 1,594 May-01-2023, 09:06 PM
Last Post: deanhystad
  List all possibilities of a nested-list by flattened lists sparkt 1 947 Feb-23-2023, 02:21 PM
Last Post: sparkt
  Find (each) element from a list in a file tester_V 3 1,265 Nov-15-2022, 08:40 PM
Last Post: tester_V
Question Keyword to build list from list of objects? pfdjhfuys 3 1,617 Aug-06-2022, 11:39 PM
Last Post: Pedroski55
  Membership test for an element in a list that is a dict value for a particular key? Mark17 2 1,239 Jul-01-2022, 10:52 PM
Last Post: Pedroski55
  How to find the second lowest element in the list? Anonymous 3 2,059 May-31-2022, 01:58 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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