The bug is probably somewhere else in your code, because it should work fine:
>>> 3 not in [2, 3, 4]
False
>>> 3 not in [4, 5, 6]
True
Or with tuples:
>>> (2, 3) not in [(2, 3), (5, 6), (9, 1)]
False
>>> (2, 3) not in [(2, 7), (7, 3), "hi"]
True
More Related Contents:
- Print cubes of the numbers 1 through 10 only if the cube is evenly divisible by four
- I have a list of file names and I need to be able to count how many of the same file gets repeated for each file name [closed]
- Python 2: Conditional statement behaviour of lists with greater/smaller [duplicate]
- How do I check if a list is empty?
- How can I return two values from a function in Python?
- Python pandas insert list into a cell
- Python recursion with list returns None [duplicate]
- Why is a list comprehension so much faster than appending to a list?
- How to remove \n from a list element?
- Is there a short contains function for lists?
- How can I access the nested data in this complex JSON, which includes another JSON document as one of the strings?
- Subtracting 2 lists in Python
- Looping over a list in Python [closed]
- How to sort and remove duplicates from Python list? [duplicate]
- Finding elements not in a list
- TypeError: unhashable type: ‘list’ when using built-in set function
- Sorting a dictionary with lists as values, according to an element from the list
- Removing Punctuation From Python List Items
- Using a dict to translate numbers to letters in python
- How can I make a dictionary (dict) from separate lists of keys and values?
- How do I get the number of elements in a list (length of a list) in Python?
- set of list of lists in python
- How to create multiple lists? [duplicate]
- flatten list of list through list comprehension
- Loop through list with both content and index [duplicate]
- In Python, is there an elegant way to print a list in a custom format without explicit looping?
- Retrieve the two highest item from a list containing 100,000 integers
- Python find list lengths in a sublist
- Python: Random numbers into a list
- How to create a nested dictionary from a list in Python?