utils module¶
random_string(string_length=3)
¶
Generate a random string of fixed length.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
string_length |
int |
Fixed length. Defaults to 3. |
3 |
Returns:
| Type | Description |
|---|---|
str |
A random string |
Source code in geohydrodemo/utils.py
def random_string(string_length = 3):
"""Generate a random string of fixed length.
Args:
string_length (int, optional): Fixed length. Defaults to 3.
Returns:
str: A random string
"""
letters = string.ascii_lowercase
return "".join(random.choice(letters) for i in range(string_length))
Last update:
2023-08-01
Created: 2023-08-01
Created: 2023-08-01