util.lists.sublist
Returns a sublist from a list, from start
to end
. Negative numbers indicate distance from the end of the list.
def sublist(
lst: list = None, # Required
start: dec or int=0,
end: dec, int, or None=None,
):
Returns a list from start
to end
.
Example:
foo = [1, 2, 3]
# bar == [1, 2]
bar = util.lists.sublist(lst=foo, start=0, end=2)
# bar == [2, 3]
bar = util.lists.sublist(lst=foo, start=1, end=3)
# bar == [1, 2]
bar = util.lists.sublist(lst=foo, start=0, end=-1)
# bar == [1]
bar = util.lists.sublist(lst=foo, start=0, end=-2)
# bar == [3]
bar = util.lists.sublist(lst=foo, start=-1, end=3)