Monday, 2 September 2013

Python: Split a list into sub-lists based on index ranges

Python: Split a list into sub-lists based on index ranges

In python, how do i split a list into sub-lists based on index ranges
e.g. original list:
list1 = [x,y,z,a,b,c,d,e,f,g]
using index ranges 0 - 4:
list1a = [x,y,z,a,b]
using index ranges 5-9:
list1b = [c,d,e,f,g]
thanks!

No comments:

Post a Comment