Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pairwise function python

# itertools — Functions creating iterators for efficient looping
# See : https://docs.python.org/3/library/itertools.html
import itertools
x = [A,1,B,2]
l = list(itertools.combinations(x, 2))
print(l)
[(A, 1), (A, B), (A, 2), (1, B), (1, 2), (B, 2)]
 
PREVIOUS NEXT
Tagged: #pairwise #function #python
ADD COMMENT
Topic
Name
5+8 =