Slice « List « Python Tutorial

Home
Python Tutorial
1.Introduction
2.Data Type
3.Statement
4.Operator
5.String
6.Tuple
7.List
8.Dictionary
9.Collections
10.Function
11.Class
12.File
13.Buildin Function
14.Buildin Module
15.Database
16.Regular Expressions
17.Thread
18.Tkinker
19.wxPython
20.XML
21.Network
22.CGI Web
23.Windows
Python Tutorial » List » Slice 
7.23.Slice
7.23.1.Slicing to access ranges of elements
7.23.2.LHS slice and the RHS may each be of any length
7.23.3.Slicing Shorthand
7.23.4.The first is inclusive, and the second is exclusive
7.23.5.Slice more than what you have
7.23.6.Slice from the end
7.23.7.If the slice continues to the end of the sequence, you may simply leave out the last index
7.23.8.If the slice continues to the start of the sequence, you may simply leave out the first index
7.23.9.copy the entire sequence, you may leave out both indices
7.23.10.Another parameter, which normally is left implicit, is the step length
7.23.11.A step size of two will include only every other element of the interval between the start and the end:
7.23.12.if you want every fourth element of a sequence, you only have to supply a step size of four:
7.23.13.Negative step size
7.23.14.Slicing a List
7.23.15.End slice
7.23.16.Middle slice
7.23.17.Negative Indices
7.23.18.Revese and skip
7.23.19.The starting and ending indices can exceed the length of the string.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.