mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
typos [h/t G.P.]
This commit is contained in:
@@ -234,7 +234,7 @@ body{counter-reset:h1 2}
|
||||
<a><samp class=p>>>> </samp><kbd class=pp>a_list[3:]</kbd> <span class=u>⑤</span></a>
|
||||
<samp class=pp>['z', 'example']</samp>
|
||||
<a><samp class=p>>>> </samp><kbd class=pp>a_list[:]</kbd> <span class=u>⑥</span></a>
|
||||
['a', 'b', 'mpilgrim', 'z', 'example']</pre>
|
||||
<samp class=pp>['a', 'b', 'mpilgrim', 'z', 'example']</samp></pre>
|
||||
<ol>
|
||||
<li>You can get a part of a list, called a “slice”, by specifying two indices. The return value is a new list containing all the items of the list, in order, starting with the first slice index (in this case <code>a_list[1]</code>), up to but not including the second slice index (in this case <code>a_list[3]</code>).
|
||||
<li>Slicing works if one or both of the slice indices is negative. If it helps, you can think of it this way: reading the list from left to right, the first slice index specifies the first item you want, and the second slice index specifies the first item you don’t want. The return value is everything in between.
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<title>Your first Python program - Dive into Python 3</title>
|
||||
<!--[if IE]><script src=j/html5.js></script><![endif]-->
|
||||
<link rel=stylesheet href=dip3.css>
|
||||
<link rel=stylesheet href=prettify.css>
|
||||
<style>
|
||||
body{counter-reset:h1 1}
|
||||
table{border:1px solid #bbb;border-collapse:collapse;margin:auto}
|
||||
|
||||
Reference in New Issue
Block a user