Python3 implements the method of generating random passwords
- 2020-04-02 14:01:19
- OfStack
This paper illustrates the method of generating random cipher in Python3. Specific methods are as follows:
The example of this paper mainly realizes the creation of 8-bit random cipher (case letters + Numbers), and USES Python3 to generate the random cipher of the primary algorithm.
The main function code is as follows:
__author__ = 'Goopand'
import string
import random
def genPassword(length=8,chars=string.digits+string.ascii_letters):
return ''.join(random.sample(chars*10,8))
if __name__=="__main__":
for i in range(10):
print(genPassword(8))
Hopefully, the examples described in this article will be helpful for your Python programming.