About 8,700,000 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 …

  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 …

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

    Suppose I have a list with X elements [4,76,2,8,6,4,3,7,2,1...] I'd like the first 5 elements. Unless it has less than 5 elements. [4,76,2,8,6] How to do that?

  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 …

  5. Understanding string reversal via slicing - Stack Overflow

    It's using extended slicing - a string is a sequence in Python, and shares some methods with other sequences (namely lists and tuples). There are three parts to slicing - start, stop and step. All …

  6. string - Python reverse-stride slicing - Stack Overflow

    Dec 15, 2014 · Python reverse-stride slicing Asked 14 years, 6 months ago Modified 6 months ago Viewed 47k times

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

    Nov 23, 2019 · 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 …

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

    3 You can also use the None keyword for the end parameter when slicing. This would also return the elements till the end of the list (or any sequence such as tuple, string, etc.)

  9. How can I slice a string in c#? - Stack Overflow

    Jan 5, 2014 · 35 string word = "hello"; So what I want to do is slice the string so that I can print, for example, elloh to the console window. In python it's so simple but I'm not sure if there's a …

  10. How does assignment work with list slices? - Stack Overflow

    140 Python docs says that slicing a list returns a new list. Now if a "new" list is being returned I've the following questions related to "Assignment to slices" a = [1, 2, 3] a[0:2] = [4, 5] print a Now …