About 22,000,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 fine to use a for …

  2. join list of lists in python - Stack Overflow

    Apr 4, 2009 · Closed 9 years ago. Is the a short syntax for joining a list of lists into a single list ( or iterator) in python? For example I have a list as follows and I want to iterate over a,b and c.

  3. slice - How slicing in Python works - Stack Overflow

    Python slicing is a computationally fast way to methodically access parts of your data. In my opinion, to be even an intermediate Python programmer, it's one aspect of the language that it is necessary to …

  4. python - How do I make a flat list out of a list of lists? - Stack Overflow

    If your list of lists comes from a nested list comprehension, the problem can be solved more simply/directly by fixing the comprehension; please see How can I get a flat result from a list …

  5. python - Removing duplicates in lists - Stack Overflow

    Nov 1, 2011 · In fact, despite the title "Python removing duplicates in lists", it doesn't seem like OP wanted to remove duplicates from within the same list at all. Rather, it looks like OP wanted to take …

  6. How do I get the number of elements in a list (length of a list) in Python?

    Nov 11, 2009 · Explanation Everything in Python is an object, including lists. All objects have a header of some sort in the C implementation. Lists and other similar builtin objects with a "size" in Python, in …

  7. python - Regular Expressions: Search in list - Stack Overflow

    Dec 20, 2024 · I want to filter strings in a list based on a regular expression. Is there something better than [x for x in list if r.match(x)] ?

  8. python - Best way to remove elements from a list - Stack Overflow

    Feb 2, 2014 · Python’s lists are variable-length arrays, not Lisp-style linked lists. The implementation uses a contiguous array of references to other objects, and keeps a pointer to this array. This makes …

  9. Identify duplicate values in a list in Python - Stack Overflow

    Is it possible to get which values are duplicates in a list using python? I have a list of items:

  10. python - How do I clone a list so that it doesn't change unexpectedly ...

    4147 new_list = my_list doesn't actually create a second list. The assignment just copies the reference to the list, not the actual list, so both new_list and my_list refer to the same list after the assignment. …