About 51 results
Open links in new tab
  1. slice - How slicing in Python works - Stack Overflow

    Understanding the difference between indexing and slicing: Wiki Python has this amazing picture which clearly distinguishes indexing and slicing. It is a list with six elements in it. To understand slicing …

  2. what does [::-1] mean in python - slicing? - Stack Overflow

    The method you used is called Slicing in Python. Slicing syntax in python is as follows, [ <first element to include> : <first element to exclude> : <step> ] where adding the step part is optional. Here is a …

  3. How to slice a list in Python - Stack Overflow

    This creates a new list, it doesn't trim the existing one. To trim in-place, use del on a slice; e.g. del listobj[-x:] will remove the last x elements from the list object.

  4. c++ - What is object slicing? - Stack Overflow

    Nov 8, 2008 · The slicing problem in C++ arises from the value semantics of its objects, which remained mostly due to compatibility with C structs. You need to use explicit reference or pointer syntax to …

  5. Python slicing operator [start:stop:step] - Stack Overflow

    I get the idea of the slicing operator in Python, but I am kind of confused at "stop". For instance:

  6. Slicing un lista en python - Stack Overflow en español

    Feb 6, 2022 · Cuando haces letters[1:] efectivamente estás seleccionando todos los componentes de una lista desde el 1 en adelante (es decir, todos menos el primero) y estás en lo correcto en suponer …

  7. python - Slicing a dictionary - Stack Overflow

    I have a dictionary, and would like to pass a part of it to a function, that part being given by a list (or tuple) of keys. Like so: # the dictionary d = {1:2, 3:4, 5:6, 7:8} # the subset of keys ...

  8. python - Slicing of a NumPy 2d array, or how do I extract an mxm ...

    Nov 23, 2010 · Slicing of a NumPy 2d array, or how do I extract an mxm submatrix from an nxn array (n>m)? Asked 15 years, 2 months ago Modified 7 years, 5 months ago Viewed 270k times

  9. Slicing a list in Python without generating a copy

    Feb 27, 2011 · Given a list of integers L, I need to generate all of the sublists L[k:] for k in [0, len(L) - 1], without generating copies. How do I accomplish this in Python? With a buffer object somehow?

  10. python - Implementing slicing in __getitem__ - Stack Overflow

    The __getitem__() method will receive a slice object when the object is sliced. Simply look at the start, stop, and step members of the slice object in order to get the components for the slice.