Created
June 14, 2022 06:18
-
-
Save AmirAref/e9241d7e01239cc4b2b731f157b04eb9 to your computer and use it in GitHub Desktop.
use `itertools` to product all items that possible with some lists
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 | |
# index 1 and 2 always will be one, but the index 1 and 3 will be different (zero or one) | |
data = [ ['0', '1'], ['1'], ['1'], ['0', '1'] ] | |
a = itertools.product(*data) | |
print(list(a)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment