Created
April 20, 2022 23:46
-
-
Save aaronshaver/5ed7c9f4e0a5dfce9d592fb49b7e004a to your computer and use it in GitHub Desktop.
Get all combinations of a list of lists using itertools.product
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
sets = [['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i']] # lists do not have to be of equal size | |
combinations = list(itertools.product(*sets)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment