Split a list into sub-lists based on index ranges
In python, it’s called slicing. Here is an example of python’s slice notation: >>> list1 = [‘a’,’b’,’c’,’d’,’e’,’f’,’g’,’h’, ‘i’, ‘j’, ‘k’, ‘l’] >>> print list1[:5] [‘a’, ‘b’, ‘c’, ‘d’, ‘e’] >>> print list1[-7:] [‘f’, ‘g’, ‘h’, ‘i’, ‘j’, ‘k’, ‘l’] Note how you can slice either positively or negatively. When you use a negative number, it … Read more