About 50 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. list - what does [::-1] mean in python - slicing? - Stack Overflow

    Python interpreter is smart enough to convert a slice of range into another range. This is an optimization, ranges are generators. They are dynamic, i.e. they don't hold all the elements in …

  3. How to slice a list from an element n to the end in Python?

    How to slice a list from an element n to the end in Python? Asked 16 years, 7 months ago Modified 3 days ago Viewed 201k times

  4. Slicing a list using a variable, in Python - Stack Overflow

    May 13, 2012 · Given a list a = range(10) You can slice it using statements such as a[1] a[2:4] However, I want to do this based on a variable set elsewhere in the code. I can easily do this …

  5. Python: slicing a multi-dimensional array - Stack Overflow

    Feb 27, 2023 · Python's slicing also doesn't support 2D/multi-dimensional slicing for lists. The expected output for slicing a multi-dimensional list can be tricky. For example, If you want the …

  6. python - Big-O of list slicing - Stack Overflow

    However, Python lists may also be indexed my_list[i_1:i_2] where a "slice" of the list from i_1 to i_2 is desired. What is the Big-O (worst-case) notation to slice a list of size N?

  7. python - Slicing/selecting with multiple conditions with OR …

    Slicing/selecting with multiple conditions with OR statement in a pandas dataframe Asked 8 years, 8 months ago Modified 2 years, 6 months ago Viewed 61k times

  8. How do I reverse a part (slice) of a list in Python?

    Nit: " Slicing Python lists always creates copies "—except when they are assigned to, as in a[2:4] = reversed(a[2:4]) in the OP's example. People may be led to think that x = reversed(x) and …

  9. How do I get a substring of a string in Python? - Stack Overflow

    Aug 31, 2016 · Sure, the specific example of selecting alternate characters may not be relevant to the question, but understanding there is a 3rd parameter to slicing very much is relevant and …

  10. How to get last items of a list in Python? - Stack Overflow

    Mar 14, 2009 · 108 Slicing Python slicing is an incredibly fast operation, and it's a handy way to quickly access parts of your data. Slice notation to get the last nine elements from a list (or any …