If the slice continues to the end of the sequence, you may simply leave out the last index : Slice « List « Python Tutorial

Python Tutorial
1. Introduction
2. Data Type
3. Statement
4. Operator
5. String
6. Tuple
7. List
8. Dictionary
9. Collections
10. Function
11. Class
12. File
13. Buildin Function
14. Buildin Module
15. Database
16. Regular Expressions
17. Thread
18. Tkinker
19. wxPython
20. XML
21. Network
22. CGI Web
23. Windows
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorial
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Python Tutorial » List » Slice 
7. 23. 7. If the slice continues to the end of the sequence, you may simply leave out the last index
numbers = [12345678910]
numbers[-3:]
7. 23. Slice
7. 23. 1. Slicing to access ranges of elements
7. 23. 2. LHS slice and the RHS may each be of any length
7. 23. 3. Slicing Shorthand
7. 23. 4. The first is inclusive, and the second is exclusive
7. 23. 5. Slice more than what you have
7. 23. 6. Slice from the end
7. 23. 7. If the slice continues to the end of the sequence, you may simply leave out the last index
7. 23. 8. If the slice continues to the start of the sequence, you may simply leave out the first index
7. 23. 9. copy the entire sequence, you may leave out both indices
7. 23. 10. Another parameter, which normally is left implicit, is the step length
7. 23. 11. A step size of two will include only every other element of the interval between the start and the end:
7. 23. 12. if you want every fourth element of a sequence, you only have to supply a step size of four:
7. 23. 13. Negative step size
7. 23. 14. Slicing a List
7. 23. 15. End slice
7. 23. 16. Middle slice
7. 23. 17. Negative Indices
7. 23. 18. Revese and skip
7. 23. 19. The starting and ending indices can exceed the length of the string.
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.