官术网_书友最值得收藏!

Post colon

Now if I put the colon on the other side of the 3, that says I want everything after 3, so 3 and after. If I say x[3:], that's giving me the third element, 0, 1, 2, 3, and everything after it. So that's going to return 4, 5, and 6 in that example, OK?

x[3:]

The output is as follows:

[4, 5, 6]

You might want to keep this IPython/Jupyter Notebook file around. It's a good reference, because sometimes it can get confusing as to whether the slicing operator includes that element or if it's up to or including it or not. So the best way is to just play around with it here and remind yourself.

主站蜘蛛池模板: 色达县| 太白县| 潍坊市| 达尔| 呼玛县| 广宁县| 怀来县| 宾川县| 宁波市| 清原| 康马县| 富宁县| 清镇市| 获嘉县| 资阳市| 阆中市| 乡宁县| 洛阳市| 杭锦旗| 榆林市| 奉贤区| 报价| 大姚县| 崇义县| 武邑县| 安远县| 同德县| 澜沧| 石棉县| 文山县| 安龙县| 宝应县| 鄂伦春自治旗| 那曲县| 剑河县| 时尚| 武鸣县| 杭锦后旗| 株洲县| 深州市| 郎溪县|