Last active
April 18, 2018 01:23
-
-
Save RyukGremory/36b3ae28ec0e12d52d6c53863f1b067b to your computer and use it in GitHub Desktop.
Generador de combinaciones a partir de un set de caracteres.
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
| import hashlib | |
| import itertools | |
| #Que elementos tomara en cuenta para hacer el diccionario | |
| elementos = '20142199PabloAndrésDelaCruzSánchezpdelacruz' | |
| def get_only_chars(string): | |
| return "".join(set(string)) | |
| def proceso(n): | |
| listado= list(itertools.combinations_with_replacement(elementos, n)) | |
| with open('dictionary_plain.txt','a+') as dictionaryfile: | |
| for e in range(len(listado)-1): | |
| elemento=str("".join(str(x) for x in listado[e])).replace(' ','') | |
| dictionaryfile.write(elemento+'\n') | |
| if __name__=='__main__': | |
| for i in range(1,5): proceso(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment