DEV Community

Free Python Code
Free Python Code

Posted on

How To Make a Smart Password Generator

Hi πŸ™‚πŸ–

In this post, I will share a simple idea with you.
This idea about password generation is that we will use a password to generate a password like this.

for ex:

abc123/* -> cwy572<> 
Enter fullscreen mode Exit fullscreen mode

As you can see, the password contains similar content to each
other

 import string from random import choice def generate_like_this(password): password_content = [ string.digits, string.punctuation, string.ascii_lowercase, string.ascii_uppercase ] new_pass = '' for p_char in password: for p_list in password_content: if p_char in p_list: new_pass += choice(p_list) return new_pass result = generate_like_this('abc123/*') print(result) 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)