Created
March 25, 2022 19:55
-
-
Save vadviktor/1d3dbe40d47bab9330364ffdd452f8cb to your computer and use it in GitHub Desktop.
Python random password generator
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
# https://stackoverflow.com/questions/3854692/generate-password-in-python | |
import string | |
import secrets | |
length = 42 | |
password = "" | |
for _ in range(length): | |
l = secrets.choice(string.ascii_lowercase) | |
u = secrets.choice(string.ascii_uppercase) | |
d = secrets.choice(string.digits) | |
s = secrets.choice(string.punctuation) | |
password += secrets.choice(l + u + d + s) | |
print(password) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment