Functions
Password

password() function

The password() function generates a cryptographically secure random password.

Syntax

Basic

Will return a 20 character long password with letters, numbers, and symbols.

strig.password() # Example output: 'aB!3D$e9Fg%H7jKl@rQ'

Parameters

ParameterTypeDefaultDescription
lengthint20The length of the generated password.
prefixstr""A string to add at the beginning of the generated password. This will add to the length of the generated password.
casestrNoneDetermines the letter case. Possible values are "upper" (only uppercase letters), "lower" (only lowercase letters), or None (mix of both uppercase and lowercase letters).
digitsboolTrueWhether the password includes digits (0-9).
symbolsboolTrueWhether the password includes symbols (e.g., !, @, ^, etc.).