Python Forum
Check if multiple values exist in a list
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check if multiple values exist in a list
#1
I am trying to find a way of testing whether or not at least one element from a list #1 is present in a list #2
One thing I've found is this thread: http://stackoverflow.com/questions/74028...-in-a-list though I dont' really understand the first(accepted) answer. If someone could break that answer down or suggest an alternative way of doing it, that would be a big help. 

It would look like:

mylist = [1,2,3,4]
mylist2 = [4,5,6]


if (any(mylist) in mylist2):
Reply


Messages In This Thread
Check if multiple values exist in a list - by glidecode - Oct-06-2016, 06:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with to check an Input list data with a data read from an external source sacharyya 3 416 Mar-09-2024, 12:33 PM
Last Post: Pedroski55
  [solved] list content check paul18fr 6 718 Jan-04-2024, 11:32 AM
Last Post: deanhystad
  __init__() got multiple values for argument 'schema' dawid294 4 2,402 Jan-03-2024, 09:42 AM
Last Post: buran
  Copying the order of another list with identical values gohanhango 7 1,168 Nov-29-2023, 09:17 PM
Last Post: Pedroski55
  Search Excel File with a list of values huzzug 4 1,258 Nov-03-2023, 05:35 PM
Last Post: huzzug
  UndefinedEnvironmentName: 'extra' does not exist in evaluation environment EarthAndMoon 3 1,703 Oct-09-2023, 05:38 PM
Last Post: snippsat
  Comparing List values to get indexes Edward_ 7 1,169 Jun-09-2023, 04:57 PM
Last Post: deanhystad
  How to check multiple columns value within range SamLiu 2 1,163 Mar-13-2023, 09:32 AM
Last Post: SamLiu
  Adding values with reduce() function from the list of tuples kinimod 10 2,674 Jan-24-2023, 08:22 AM
Last Post: perfringo
  user input values into list of lists tauros73 3 1,075 Dec-29-2022, 05:54 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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