Python Forum
How to check if a list is in another list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to check if a list is in another list
#1
Hi All,

I have the below code:

list_1 = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]

win_1 = ["1", "2", "3", "4"]

if win_1 in list_1:
    print("yes")
It doesn't print anything, how do I check if a list is in another list?
"Only Boring People Get Bored"
Reply


Messages In This Thread
How to check if a list is in another list - by finndude - Jan-17-2022, 09:33 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Strange behavior list of list mmhmjanssen 2 126 6 hours ago
Last Post: Gribouillis
  Help with to check an Input list data with a data read from an external source sacharyya 3 430 Mar-09-2024, 12:33 PM
Last Post: Pedroski55
  [solved] list content check paul18fr 6 736 Jan-04-2024, 11:32 AM
Last Post: deanhystad
  No matter what I do I get back "List indices must be integers or slices, not list" Radical 4 1,212 Sep-24-2023, 05:03 AM
Last Post: deanhystad
  Check if two matrix are equal and of not add the matrix to the list quest 3 858 Jul-10-2023, 02:41 AM
Last Post: deanhystad
  Delete strings from a list to create a new only number list Dvdscot 8 1,569 May-01-2023, 09:06 PM
Last Post: deanhystad
  List all possibilities of a nested-list by flattened lists sparkt 1 936 Feb-23-2023, 02:21 PM
Last Post: sparkt
  Сheck if an element from a list is in another list that contains a namedtuple elnk 8 1,867 Oct-26-2022, 04:03 PM
Last Post: deanhystad
Question Keyword to build list from list of objects? pfdjhfuys 3 1,590 Aug-06-2022, 11:39 PM
Last Post: Pedroski55
  check if element is in a list in a dictionary value ambrozote 4 2,004 May-11-2022, 06:05 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