Skip to content

Instantly share code, notes, and snippets.

@yegle
Created November 17, 2012 18:12
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 yegle/4098405 to your computer and use it in GitHub Desktop.
Save yegle/4098405 to your computer and use it in GitHub Desktop.
python itertools
from itertools import product
import string
print(list(product(string.lowercase[:13],repeat=2)))
[('a', 'a'), ('a', 'b'), ('a', 'c'), ('a', 'd'), ('a', 'e'), ('a', 'f'), ('a', 'g'), ('a', 'h'), ('a', 'i'), ('a', 'j'), ('a', 'k'), ('a', 'l'), ('a', 'm'), ('b', 'a'), ('b', 'b'), ('b', 'c'), ('b', 'd'), ('b', 'e'), ('b', 'f'), ('b', 'g'), ('b', 'h'), ('b', 'i'), ('b', 'j'), ('b', 'k'), ('b', 'l'), ('b', 'm'), ('c', 'a'), ('c', 'b'), ('c', 'c'), ('c', 'd'), ('c', 'e'), ('c', 'f'), ('c', 'g'), ('c', 'h'), ('c', 'i'), ('c', 'j'), ('c', 'k'), ('c', 'l'), ('c', 'm'), ('d', 'a'), ('d', 'b'), ('d', 'c'), ('d', 'd'), ('d', 'e'), ('d', 'f'), ('d', 'g'), ('d', 'h'), ('d', 'i'), ('d', 'j'), ('d', 'k'), ('d', 'l'), ('d', 'm'), ('e', 'a'), ('e', 'b'), ('e', 'c'), ('e', 'd'), ('e', 'e'), ('e', 'f'), ('e', 'g'), ('e', 'h'), ('e', 'i'), ('e', 'j'), ('e', 'k'), ('e', 'l'), ('e', 'm'), ('f', 'a'), ('f', 'b'), ('f', 'c'), ('f', 'd'), ('f', 'e'), ('f', 'f'), ('f', 'g'), ('f', 'h'), ('f', 'i'), ('f', 'j'), ('f', 'k'), ('f', 'l'), ('f', 'm'), ('g', 'a'), ('g', 'b'), ('g', 'c'), ('g', 'd'), ('g', 'e'), ('g', 'f'), ('g', 'g'), ('g', 'h'), ('g', 'i'), ('g', 'j'), ('g', 'k'), ('g', 'l'), ('g', 'm'), ('h', 'a'), ('h', 'b'), ('h', 'c'), ('h', 'd'), ('h', 'e'), ('h', 'f'), ('h', 'g'), ('h', 'h'), ('h', 'i'), ('h', 'j'), ('h', 'k'), ('h', 'l'), ('h', 'm'), ('i', 'a'), ('i', 'b'), ('i', 'c'), ('i', 'd'), ('i', 'e'), ('i', 'f'), ('i', 'g'), ('i', 'h'), ('i', 'i'), ('i', 'j'), ('i', 'k'), ('i', 'l'), ('i', 'm'), ('j', 'a'), ('j', 'b'), ('j', 'c'), ('j', 'd'), ('j', 'e'), ('j', 'f'), ('j', 'g'), ('j', 'h'), ('j', 'i'), ('j', 'j'), ('j', 'k'), ('j', 'l'), ('j', 'm'), ('k', 'a'), ('k', 'b'), ('k', 'c'), ('k', 'd'), ('k', 'e'), ('k', 'f'), ('k', 'g'), ('k', 'h'), ('k', 'i'), ('k', 'j'), ('k', 'k'), ('k', 'l'), ('k', 'm'), ('l', 'a'), ('l', 'b'), ('l', 'c'), ('l', 'd'), ('l', 'e'), ('l', 'f'), ('l', 'g'), ('l', 'h'), ('l', 'i'), ('l', 'j'), ('l', 'k'), ('l', 'l'), ('l', 'm'), ('m', 'a'), ('m', 'b'), ('m', 'c'), ('m', 'd'), ('m', 'e'), ('m', 'f'), ('m', 'g'), ('m', 'h'), ('m', 'i'), ('m', 'j'), ('m', 'k'), ('m', 'l'), ('m', 'm')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment