Skip to content

Instantly share code, notes, and snippets.

@AmirAref
Created June 14, 2022 06:18
Show Gist options
  • Save AmirAref/e9241d7e01239cc4b2b731f157b04eb9 to your computer and use it in GitHub Desktop.
Save AmirAref/e9241d7e01239cc4b2b731f157b04eb9 to your computer and use it in GitHub Desktop.
use `itertools` to product all items that possible with some lists
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