Mega Code Archive

 
Categories / Python / List
 

Slicing works similar to strings; use the square bracket slice operator ([ ] ) along with the index or indices

aList = [123, 'abc', 4.56, ['inner', 'list'], 7-9j] aList[0] print aList[1:4] print aList[:3] print aList[3][1]