Aug-10-2020, 06:10 PM
import secrets import sys import time import string from tenacity import (retry , stop_after_attempt) #Required Defs var = open('conf.txt','r+') content = var.read() print(content) def get_random_string(length): letters = string.ascii_lowercase num = string.ascii_uppercase punc = string.punctuation spec = string.hexdigits one = str(num) + str(punc) + str(spec) result_str = ''.join(secrets.choice(one) for i in range(length)) print("Random string of length", length, "is:", result_str) #CLosing All Defs Here @retry(stop=stop_after_attempt(5)) def start(): pasw = input("Do YOu Want A Random Password: y/n: ") if pasw == 'y': leng = input("Please Type The Length Of The Password You Want: ") try: len1 = int(leng) get_random_string(len1) time.sleep(4) except ValueError: print("Only Numbers Accepted") time.sleep(4) elif pasw == 'n': sys.exit("You Don't Want TO Run The Program") time.sleep(3) else: raise Exception("Choose Only From 'y' or 'n'") start()Conf.txt
Quote:minchars = 1
minnumbers = 3
minletter = 2
minhex = 2