Created
September 10, 2018 03:10
-
-
Save jiankaiwang/18321132b53a171b6780df8b857d53c9 to your computer and use it in GitHub Desktop.
generate several passwords in python
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
# coding: utf8 | |
# desc: generate several passwords in python | |
import random | |
sets = (int)(input("How many passwords you need ? ")) | |
pwdLen = (int)(input("The length of each password ? ")) | |
pwdComposition = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789^&*()_" | |
pwdMaterial = [] | |
for index in range(0, len(pwdComposition), 1): | |
pwdMaterial.append(pwdComposition[index]) | |
for index in range(0,sets,1): | |
print("Password %d : %s" % (index, "".join(random.sample(pwdMaterial, pwdLen)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment