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

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.

主站蜘蛛池模板: 隆德县| 金溪县| 凌云县| 密山市| 巨野县| 新宁县| 广水市| 广安市| 玉门市| 同德县| 五家渠市| 汉中市| 清新县| 上高县| 温泉县| 安多县| 罗定市| 远安县| 康保县| 延长县| 开化县| 延长县| 张北县| 永兴县| 栾城县| 安达市| 梁平县| 清水县| 阳谷县| 玉门市| 神木县| 左云县| 逊克县| 永新县| 崇左市| 天峻县| 大理市| 娱乐| 张家港市| 南靖县| 冷水江市|