- Hands-On Data Science and Python Machine Learning
- Frank Kane
- 120字
- 2021-07-15 17:15:00
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.
推薦閱讀
- Fundamentals of Linux
- Java程序設(shè)計(jì):原理與范例
- 運(yùn)用后端技術(shù)處理業(yè)務(wù)邏輯(藍(lán)橋杯軟件大賽培訓(xùn)教材-Java方向)
- Python Data Science Cookbook
- Access 2010數(shù)據(jù)庫(kù)應(yīng)用技術(shù)實(shí)驗(yàn)指導(dǎo)與習(xí)題選解(第2版)
- 計(jì)算機(jī)應(yīng)用技能實(shí)訓(xùn)教程
- C語(yǔ)言程序設(shè)計(jì)
- Learning Kotlin by building Android Applications
- Groovy 2 Cookbook
- Microsoft Dynamics GP 2013 Cookbook
- Developer,Advocate!
- 零基礎(chǔ)學(xué)Java(升級(jí)版)
- Getting Started with SQL Server 2014 Administration
- Neo4j High Performance
- Mastering Puppet(Second Edition)