Method 1
Just import combinations from itertools module in python. So by using this code you can get what you wanted.
>>> from itertools import combinations
>>> print(list(map(list,combinations([0, 1, 2], 2))))
[[0, 1], [0, 2], [1, 2]]
Method 2 (To get unique list)
In this question you also said that you need to generate unique arrays also, So lets assume that your array is [0,1,1].You just can use this one,
>>> from itertools import combinations
>>> print(list(map(list,{*map(tuple,combinations([0, 1, 2], 2))})))
[[0, 1], [1, 1]]
In sets removes duplicate items. So after that you have to convert set to list also.
Method 3 (Recursive method)
def myComb(lst):
if len(lst) == 0:
return []
elif len(lst) == 1:
return [lst]
else:
l = []
for i in range(len(lst)):
x = lst[i]
xs = lst[:i] + lst[i+1:]
for p in myComb(xs):
l.append([x]+p)
return l
ans=[]
for p in myComb([0,1,2]):
p.pop()
p.sort()
if p not in ans:
ans.append(p)
print(ans)
ans=[[0, 1], [0, 2], [1, 2]]