Created
August 17, 2020 04:17
-
-
Save gwsu2008/7f35360f0d10d100525c401e69d08799 to your computer and use it in GitHub Desktop.
python-random-password
This file contains 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
FROM: https://gist.github.com/prgrm/a85d2da1a1be791bfdd6/raw/91f343659e917f2b8a94b73d5b5b0e44ac40be4b/Ex15 | |
# generate a password with length "passlen" with no duplicate characters in the password | |
import random | |
s = "abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()?" | |
passlen = 8 | |
p = "".join(random.sample(s,passlen )) | |
print p | |
FROM: https://gist.github.com/anonymous/4a752288b785312ca840/raw/bba16ba088290f8881e5321b20af0e55fa01c549/gistfile1.txt | |
import string | |
import random | |
def pw_gen(size = 8, chars=string.ascii_letters + string.digits + string.punctuation): | |
return ''.join(random.choice(chars) for _ in range(size)) | |
print(pw_gen(int(input('How many characters in your password?')))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment