I want to assign variable A and B with random string from below function. As I want to use it elsewhere in the program it to feed for password and confirm password while automating. when I run this print A or print B, it prints none. how to print what is generated.
import random
import string
# get random string password with letters, digits, and symbols
def get_random_password_string(length):
password_characters = string.ascii_letters + string.digits + string.punctuation
password = ''.join(random.choice(password_characters) for i in range(length))
print("Random string password is:", password)
A=get_random_password_string(10)
B=get_random_password_string(10)
print(A)
print(B)
Aucun commentaire:
Enregistrer un commentaire