Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@blacknon
Last active February 12, 2023 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blacknon/f81cf3d3aad1c512b4c12983fc6ddbce to your computer and use it in GitHub Desktop.
Save blacknon/f81cf3d3aad1c512b4c12983fc6ddbce to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# -*- encoding: UTF-8 -*-
import itertools
options = {
"x": ["a", "b"],
"y": [10, 20, 30]}
keys = options.keys()
values = (options[key] for key in keys)
combinations = [dict(zip(keys, combination)) for combination in itertools.product(*values)]
print(combinations)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment