import itertools
def allSubArrays(xs):
n = len(xs)
indices = list(range(n+1))
for i,j in itertools.combinations(indices,2):
yield xs[i:j]
# Python program to print all
# sublist from a given list
from itertools import combinations
# function to generate all the sub lists
def sub_lists (l):
# initializing empty list
comb = []
#Iterating till length of list
for i in range(len(l)+1):
# Generating sub list
comb += [list(j) for j in combinations([1, 2, 3], i)]
# Returning list
return comb
# driver code
#Initial list
l1 = [1, 2, 3]
#Print initial list
print("Initial list is : " + str(l1))
# Calling function to generate all sub lists
print("All sub list is : "+ str(sub_lists(l1)))