How to generate password Dictionary by python
The content of this article mainly focuses on how python generates a password dictionary. The content of the article is clear and well-organized. It is very suitable for beginners to learn and is worth reading. Interested friends can follow the editor to read together. I hope you can get something through this article!
The code and the result of the code running:
Code:
Import itertools as itswords= "rot123" a=its.product (words,repeat=4) name=open ("pass.txt", "a") for i in a: name.write (".join (I)) name.write (" .join ("\ n")) name.close ()
Code parsing:
# Import module
Import itertools as its
# the password "element" is the character that cracked the password
Words= "rot123"
# its=itertools,repeat is the number of passwords generated
A=its.product (words,repeat=4)
# write the name of the file. "a" is opened in encryption mode.
Name=open ("pass.txt", "a")
# for Loop-equivalent to cyclic words
For i in a:
# join is to concatenate elements with specified characters to generate a new string, and what connection is used to output
Name.write ("" .join (I)) #\ n is a newline
After name.write ("" .join ("\ n")) # outputs, close closes the open file
Name.close ()
Effect picture:
What can python do Python is a programming language, built in many effective tools, Python is almost omnipotent, the language is easy to understand, easy to start, powerful, in many fields, such as the most popular big data analysis, artificial intelligence, Web development and so on.
Thank you for your reading. I believe you have a certain understanding of "how to generate a password dictionary in python". Go and practice it. If you want to know more about it, you can follow the website! The editor will continue to bring you better articles!