DEV Community

Cover image for Password Generator in Python
Arpit
Arpit

Posted on • Updated on

Password Generator in Python

Let's make password generator tool in python

import string
import random

if __name__ == "__main__":
    s1 = string.ascii_lowercase
    s2 = string.ascii_uppercase
    s3 = string.digits
    s4 = string.punctuation

    plen = int(input("Enter password length: "))
    s = []
    s.extend(list(s1))
    s.extend(list(s2))
    s.extend(list(s3))
    s.extend(list(s4))

    print("Your password: ", end="")
    print("".join(random.sample(s, plen)))
Enter fullscreen mode Exit fullscreen mode

source: https://bit.ly/2YBHofb

Top comments (7)

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
soniarpit profile image
Arpit

test

Collapse
 
soniarpit profile image
Arpit

test2

Collapse
 
Sloan, the sloth mascot
Comment deleted
 
soniarpit profile image
Arpit

test

Thread Thread
 
soniarpit profile image
Arpit

test1

Thread Thread
 
soniarpit profile image
Arpit

test1