PYTHON array_search

is this article helpful?
|
Python replacement for PHP's array_search [ edit | history ]
# It works just for lists, that are number-indexed arrays:
haystack.index(needle)


# It works for dictionaries, that allows text-indexed values
index = [k for k, v in haystack.iteritems() if v == needle][0]

PHP array_search

PHP original manual for array_search [ show | php.net ]