alphanumeric()
function
The alphanumeric()
function is used to generate a random string composed of alphabetic characters and numbers.
Syntax
Basic
Will return a 6 character long string of letters and numbers
strig.alphanumeric() # Example output: 'a3D9fB'
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
length | int | 6 | The length of the generated random string. |
prefix | str | "" | A string to add at the beginning of the generated string. This will add to the length of the generated string. |
case | str | None | Determines the letter case. Possible values are "upper" (only uppercase letters and numbers), "lower" (only lowercase letters and numbers), or None (mix of both uppercase and lowercase letters, along with numbers). |