If order is not important and you don’t need to worry about duplicates then you can use set intersection:

```
>>> a = [1,2,3,4,5]
>>> b = [1,3,5,6]
>>> list(set(a) & set(b))
[1, 3, 5]
```

### Related Contents:

- Check if multiple strings exist in another string
- ValueError: setting an array element with a sequence
- Understanding NumPy’s einsum
- Python List vs. Array – when to use?
- Convert Python sequence to NumPy array, filling missing values
- How to convert a string of bytes into an int?
- Performance of Pandas apply vs np.vectorize to create new column from existing columns
- Removing nan values from an array
- How to remove specific elements in a numpy array
- Flatten list of lists [duplicate]
- Calculate mean across dimension in a 2D array
- How to return 0 with divide by zero
- Check if item is in an array / list
- Numpy sum elements in array based on its value
- Count consecutive occurences of values varying in length in a numpy array
- How to normalize a NumPy array to within a certain range?
- How can I check if one two-dimensional NumPy array contains a specific pattern of values inside it?
- Finding the consecutive zeros in a numpy array
- Getting the indices of several elements in a NumPy array at once
- Django JSONField inside ArrayField
- How do I create an empty array and then append to it in NumPy?
- Convert a 1D array to a 2D array in numpy
- How to do n-D distance and nearest neighbor calculations on numpy arrays
- What is the difference between Numpy’s array() and asarray() functions?
- How do I print the full NumPy array, without truncation?
- Reshape an array in NumPy
- PIL: Convert Bytearray to Image
- What is the difference between np.array() and np.asarray()?
- Why does numpy.zeros takes up little space
- Python: slicing a multi-dimensional array
- How to create a numpy array of arbitrary length strings?
- NumPy chained comparison with two predicates
- Find elements of array one nearest to elements of array two
- How to declare and add items to an array in Python?
- Initializing a list to a known number of elements in Python [duplicate]
- “In” operator for numpy arrays?
- Keras Sequential model with multiple inputs
- How to split a numpy array in fixed size chunks with and without overlap?
- How to find the index of a value in 2d array in Python?
- Sort invariant for numpy.argsort with multiple dimensions
- Partition array into N chunks with Numpy
- How to group elements in python by n elements [duplicate]
- Can numpy bincount work with 2D arrays?
- Why does numpy have a corresponding function for many ndarray methods?
- Numpy find indices of groups with same value
- Concatenate range arrays given start, stop numbers in a vectorized way – NumPy
- How do you extract a column from a multi-dimensional array?
- How to remove all rows in a numpy.ndarray that contain non-numeric values
- Numpy Vector (N,1) dimension -> (N,) dimension conversion
- How is numpy’s fancy indexing implemented?