- Hands-On Data Science and Python Machine Learning
- Frank Kane
- 63字
- 2021-07-15 17:15:00
Negative syntax
One more thing you can do is have this negative syntax:
x[-2:]
The output is as follows:
[5, 6]
By saying x[-2:], this means that I want the last two elements in the list. This means that go backwards two from the end, and that will give me 5 and 6, because those are the last two things on my list.
推薦閱讀
- MATLAB應用與實驗教程
- Building Mapping Applications with QGIS
- Mastering ServiceNow(Second Edition)
- Serverless架構
- 飛槳PaddlePaddle深度學習實戰
- 精通MATLAB(第3版)
- Domain-Driven Design in PHP
- Hadoop 2.X HDFS源碼剖析
- 單片機原理及應用技術
- Python Projects for Kids
- UX Design for Mobile
- 快樂編程:青少年思維訓練
- Spark技術內幕:深入解析Spark內核架構設計與實現原理
- Mastering Unreal Engine 4.X
- A/B 測試:創新始于試驗