Ongeveer 51 resultaten
Koppelingen in nieuw tabblad openen
  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

    8 nov. 2008 · 7 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 …

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

    27 feb. 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 third column …

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

    Python slicing operator [start:stop:step] Asked 2 years, 11 months ago Modified 1 year, 1 month ago Viewed 6k times

  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. Slicing un lista en python - Stack Overflow en español

    6 feb. 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 …

  9. Slicing a list in Python without generating a copy

    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.