sc4py.str module
- sc4py.str.str2bool(v: str | bool | int | None) bool | None[source]
Converts a string, boolean, or integer to a boolean value.
- Parameters:
v (str | bool | int | None) – Value to convert. Accepts various representations of true/false.
- Returns:
True, False, or None if input is None or empty.
- Return type:
bool | None
- Example::
>>> str2bool('yes') True >>> str2bool('no') False >>> str2bool(None) None