- 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.
推薦閱讀
- Data Visualization with D3 4.x Cookbook(Second Edition)
- Learning ArcGIS Pro 2
- 零基礎學Scratch少兒編程:小學課本中的Scratch創意編程
- Dependency Injection in .NET Core 2.0
- Essential Angular
- Python漫游數學王國:高等數學、線性代數、數理統計及運籌學
- 利用Python進行數據分析(原書第3版)
- Mastering Android Development with Kotlin
- 數據結構習題解析與實驗指導
- Python算法指南:程序員經典算法分析與實現
- Mobile Device Exploitation Cookbook
- Flask Web開發:基于Python的Web應用開發實戰(第2版)
- 交互式程序設計(第2版)
- Learning Bootstrap 4(Second Edition)
- Tableau Dashboard Cookbook