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.
20 def in_list(value, arg): 21 return value in ( arg or [] )
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
6 def list_has(list, x): 7 try: 8 list.index(x) 9 return True 10 except ValueError: 11 return False
40 def _is_iterable(element): 41 return hasattr(element, '__iter__') and not isinstance(element, str)
180 def has_element(lst, el): 181 for i in lst: 182 if i == el: 183 return True 184 return False