get_valid_filename
Return the given string converted to a string that can be used for a clean filename. Remove leading and trailing spaces; convert other spaces to underscores; and remove anything that is not an alphanumeric, dash, underscore, or dot.
def get_valid_filename(
name: string
) - > string
Return the given string converted to a string that can be used for a clean filename. Remove leading and trailing spaces; convert other spaces to underscores; and remove anything that is not an alphanumeric, dash, underscore, or dot.
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | The raw string or path component to be sanitized into a valid filename. |
Returns
| Type | Description |
|---|---|
string | A sanitized string safe for use as a filename, containing only alphanumeric characters, dashes, underscores, and dots. |