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
| Parameter | Type | Default | Description |
|---|---|---|---|
| length | int | 20 | The length of the generated password. |
| prefix | str | "" | A string to add at the beginning of the generated password. This will add to the length of the generated password. |
| case | str | None | Determines the letter case. Possible values are "upper" (only uppercase letters), "lower" (only lowercase letters), or None (mix of both uppercase and lowercase letters). |
| digits | bool | True | Whether the password includes digits (0-9). |
| symbols | bool | True | Whether the password includes symbols (e.g., !, @, ^, etc.). |