Is there a simple way to be able to hide my generated password with asterisks but i want the last 3 digits of the password to be visible. How do i do this? I'm also thinking maybe having length as variable isn't a good idea
import string
import random
characters = list(string.ascii_letters + string.digits + "!@#$%^&*()")
i = input('Please enter confirm (input 1) to proceed with username and password creation (or any to quit):\n')
if i == '1':
print("Generating username and password....")
length = int(input("Enter username length: "))
random.shuffle(characters)
username = characters[:length]
print("".join(username))
genusername = "".join(username)
length = int(input("Enter password length: "))
random.shuffle(characters)
password = characters[:length]
print("".join(password))
genpassword = "".join(password)
else:
exit
Aucun commentaire:
Enregistrer un commentaire