4 examples of 'check if element is in list python' in Python

Every line of 'check if element is in list python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
20def in_list(value, arg):
21 return value in ( arg or [] )
6def list_has(list, x):
7 try:
8 list.index(x)
9 return True
10 except ValueError:
11 return False
40def _is_iterable(element):
41 return hasattr(element, '__iter__') and not isinstance(element, str)
180def has_element(lst, el):
181 for i in lst:
182 if i == el:
183 return True
184 return False

Related snippets