libb.strtobool

strtobool(val)[source]

Convert a string representation of truth to boolean.

True values are ‘y’, ‘yes’, ‘t’, ‘true’, ‘on’, and ‘1’. False values are ‘n’, ‘no’, ‘f’, ‘false’, ‘off’, ‘0’, and empty string.

Parameters:

val – Value to convert (string, bool, or None).

Returns:

Boolean value.

Return type:

bool

Raises:

ValueError – If val is not a recognized truth value.