About 13,200,000 results
Open links in new tab
  1. 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 …

  2. python - Finding and replacing elements in a list - Stack Overflow

    I have to search through a list and replace all occurrences of one element with another. So far my attempts in code are getting me nowhere, what is the best way to do this? For example, …

  3. python - How do I make a flat list out of a list of lists? - Stack …

    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 …

  4. Python: list of lists - Stack Overflow

    First, I strongly recommend that you rename your variable list to something else. list is the name of the built-in list constructor, and you're hiding its normal function. I will rename list to a in the …

  5. 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 …

  6. python - How do I find the duplicates in a list and create another …

    Then because we have duplicates, in a list, we need to pick one of each duplicate, i.e. remove duplicate among duplicates, and to do so, we do call a python built-in named set (), and it …

  7. python - How to get item's position in a list? - Stack Overflow

    Dec 13, 2008 · I am iterating over a list and I want to print out the index of the item if it meets a certain condition. How would I do this? Example: testlist = [1,2,3,5,3,1,2,1,6] for item in testlist: if

  8. python - if/else in a list comprehension - Stack Overflow

    As the docs state, list comprehensions are used to create a list using a for-loop and has the general structure: [expression for item in iterable (0 or more if/for clauses)]

  9. python - Negative list index? - Stack Overflow

    18 List indexes of -x mean the xth item from the end of the list, so n[-1] means the last item in the list n. Any good Python tutorial should have told you this.

  10. 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.