constr
A wrapper around str that allows for additional constraints.
def constr(
strip_whitespace: bool | None = None,
to_upper: bool | None = None,
to_lower: bool | None = None,
strict: bool | None = None,
min_length: int | None = None,
max_length: int | None = None,
pattern: str | Pattern[str] | None = None,
ascii_only: bool | None = None
) - > type[str]
A wrapper around str that allows for additional constraints.
Parameters
| Name | Type | Description |
|---|---|---|
| strip_whitespace | `bool | None` = None |
| to_upper | `bool | None` = None |
| to_lower | `bool | None` = None |
| strict | `bool | None` = None |
| min_length | `int | None` = None |
| max_length | `int | None` = None |
| pattern | `str | Pattern[str] |
| ascii_only | `bool | None` = None |
Returns
| Type | Description |
|---|---|
type[str] | The wrapped string type. |