About 4,330,000 results
Open links in new tab
  1. python - Find a value in a list - Stack Overflow

    In Python 3, filter doesn't return a list, but a generator-like object. Finding the first occurrence If you only want the first thing that matches a condition (but you don't know what it is yet), it's …

  2. Search a list of dictionaries in Python - Stack Overflow

    I tested various methods to go through a list of dictionaries and return the dictionaries where key x has a certain value. Results: Speed: list comprehension > generator expression >> normal list …

  3. Searching a list of objects in Python - Stack Overflow

    Let's assume I'm creating a simple class to work similar to a C-style struct, to just hold data elements. I'm trying to figure out how to search a list of objects for objects with an attribute equ...

  4. Python: finding an element in a list - Stack Overflow

    What is a good way to find the index of an element in a list in Python? Note that the list may not be sorted. Is there a way to specify what comparison operator to use?

  5. python - How can I find the index for a given item in a list? - Stack ...

    Caveats Linear time-complexity in list length An index call checks every element of the list in order, until it finds a match. If the list is long, and if there is no guarantee that the value will be …

  6. python - Search in lists of lists by given index - Stack Overflow

    I have a list of two-item lists and need to search for things in it. If the list is:

  7. python - Find object in list that has attribute equal to some value ...

    I've got a list of objects. I want to find one (first or whatever) object in this list that has an attribute (or method result - whatever) equal to value. What's the best way to find it? Here's a t...

  8. python - Fastest way to check if a value exists in a list - Stack …

    What is the fastest way to check if a value exists in a very large list (with millions of values) and what its index is?

  9. Most efficient way for a lookup/search in a huge list (python)

    Dec 28, 2016 · Using a set instead of a list for that many items should only increase memory usage by <2MB, which isn't really all that much on modern hardware. If your data did grow so …

  10. Fastest way to search a list in python - Stack Overflow

    Sep 14, 2016 · When you do something like "test" in a where a is a list does python do a sequential search on the list or does it create a hash table representation to optimize the …