password generator in python

Share:


Create a password in python👀

To Make a simple password generator  you just need to follow these steps:

  • import random
  • Then take any variable and add all keyboard buttons(which you want).
  • Then write password length for example I take 6 (passlen is actually a variable).
  • Then stings.join (random.sample(s,passlen))
  • Random.sample can mix the characters in the s variable and give passlen size which we are given.


Here is the code:

import random

s = "abcdefghijklmnopqrstuvwxyz0123456789@!~#$%^&*()_+-?><:()"

passlen = 6

p ="".join(random.sample(s,passlen))

print(p)


Output:
%8dm>u                                                NOTE :Every time it gives you different password.