About 2,330,000 results
Open links in new tab
  1. slice - How slicing in Python works - Stack Overflow

    In Python 2.7. Slicing in Python [a:b:c] len = length of string, tuple or list c -- default is +1. The sign of c indicates forward or backward, absolute value of c indicates steps. Default is forward with …

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

    Here is a simple cheat sheet for understanding Slicing, a[start:end] # items start through end-1 a[start:] # items start through the rest of the array a[:end] # items from the beginning through …

  3. What is :: (double colon) in Python when subscripting sequences?

    When slicing in Python the third parameter is the step. As others mentioned, see Extended Slices for a nice overview. With this knowledge, [::3] just means that you have not specified any start …

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

    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 …

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

    Dec 17, 2021 · Slicing a python list. 0. Slicing a list specially. 1. Slice a list in python. 0. Slicing lists in python ...

  6. Shortest way to slice even/odd lines from a python array?

    Feb 14, 2011 · See lists in the Python tutorial. If you want to get every n -th element of a list (i.e. excluding the first element), you would have to slice like l[(n-1)::n] . Example:

  7. reversing list using slicing [ : 0:-1] in Python - Stack Overflow

    For the Python list slicing syntax, list[start:end:step] will get a sliced list with items starting with list[start], but list[end] is excluded. As a result, in your case, L[10:0:-1] will exclude L[0], i.e., 0, …

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

    Say I have some Python list, my_list which contains N elements. Single elements may be indexed by using my_list[i_1] , where i_1 is the index of the desired element. However, Python lists …

  9. slice - How to do reverse slicing in python? - Stack Overflow

    May 11, 2017 · slicing a string from reverse in python. 0. Python Slicing Newbie. 6. Reversing a list slice in python. 1 ...

  10. python - Does a slicing operation give me a deep or shallow copy ...

    Aug 3, 2016 · The official Python docs say that using the slicing operator and assigning in Python makes a shallow copy of the sliced list. But when I write code for example: o = [1, 2, 4, 5] p = …

Refresh