- 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.
推薦閱讀
- Visual Basic .NET程序設計(第3版)
- Intel Galileo Essentials
- Spring 5.0 By Example
- Mastering Adobe Captivate 2017(Fourth Edition)
- vSphere High Performance Cookbook
- 信息安全技術
- Python Geospatial Development(Second Edition)
- JavaScript by Example
- 組態軟件技術與應用
- 數據結構與算法分析(C++語言版)
- 詳解MATLAB圖形繪制技術
- Arduino Wearable Projects
- Building Slack Bots
- Python大規模機器學習
- Getting Started with RethinkDB