Created
October 21, 2017 21:10
-
-
Save franga2000/0885de28a1392d72f51eff35d5a9520d to your computer and use it in GitHub Desktop.
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
""" | |
Generates iterations of string from lines in a file | |
Usage: permutations.py <filename:str> <number:int> | |
Example: permutations.py wordlist.txt 2 | |
""" | |
import sys | |
from itertools import permutations | |
f = sys.argv[1] | |
n = int(sys.argv[2]) | |
l = [s.strip() for s in open(f).readlines()] | |
for p in permutations(l, n): | |
print("".join(p)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment