sertit.strings.str_to_bool¶
- str_to_bool(bool_str: str) bool [source]¶
Convert a string to a bool.
Accepted values (compared in lower case):
True <=> yes, true, t, 1
False <=> no, false, f, 0
>>> str_to_bool("yes") == True # Works with "yes", "true", "t", "y", "1" (accepted with any letter case) True >>> str_to_bool("no") == False # Works with "no", "false", "f", "n", "0" (accepted with any letter case) True
- Parameters
bool_str – Bool as a string
- Returns
Boolean value
- Return type