Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python generate random strong password

import random, string
def generate_password(length: int=4)-> str:
    # add lower case chars
    lower  = [random.choice(string.ascii_lowercase) for i in range(length)]
    # add digit chars
    digit  = [random.choice(string.digits) for i in range(length)]
    # add upper case chars
    upper  = [random.choice(string.ascii_uppercase) for i in range(length)]
    # add symbols
    symbol = [random.choice(["!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "-", "+", "=", ".", ",", "?"]) for i in range(length)]
    # store random generated lists to a variable
    original = lower+digit+upper+symbol
    # shuffle stored data in place
    random.shuffle(original)
    return ''.join(original)
 
PREVIOUS NEXT
Tagged: #python #generate #random #strong #password
ADD COMMENT
Topic
Name
2+3 =