I'm new to Python, I'm getting a simple list slice operation.
Here is the code.
& gt; & Gt; & Gt; A = [1,2,3,4]; & Gt; & Gt; & Gt; One [1: 3] [2, 3]> gt; & Gt; & Gt; A code [3] 4 to no [1: 3] instead of [2,3,4] [2,3] ?
one [1: 3] one half stop interval < / Em>, which means that the 1 values starting with the specified index, but not included 2 index < / P> In this case, a [1: 3] means that in slices, a [1] and a [2] , but no a [3] You will see similar in use. For example,
will generate a list from category 1 to 4 (1, 5) but not 5 Will be included. It is very consistent that how many programming languages are used in
Comments
Post a Comment