I am trying to generate a list of 7 letter words in python that satisfy the following conditions:
- Words are fixed length (7 letters)
- Words are only uppercase (I'm using ascii_uppercase)
- Is of the form ?D?R?T? where the ? acts as placeholders for letters.
Hence the following are valid examples:
- ADPRETE
- BDFRUTW
- JDQRQTA
- ZDZRZTZ
- QDQRQTQ
I'm using the following piece of code, but wondering how to generate words meeting the 3rd criteria. Any help/pointers would be awesome!
from string
from itertools import product
for n in range (7,8):
for arr in product(string.ascii_uppercase, repeat=n):
print ''.join(arr)