Sunday, 15 September 2013

How to check if an element exists in a Python array (Equivalent of PHP in_array)? -



How to check if an element exists in a Python array (Equivalent of PHP in_array)? -

i'm new python , i'm looking standard function tell me if element nowadays in array. found index method throws exception if element not found. need simple function homecoming true if element in array or false if not.

basically equivalent php in_array.

>>> 1 in [0, 1, 2, 3, 4, 5] true

python arrays lookup

No comments:

Post a Comment