Skip to main content

strtobool

Convert common terms for true/false to bool.

def strtobool(
term: any,
table: dict = None
) - > boolean

Convert common terms for true/false to bool.

Parameters

NameTypeDescription
termanyThe value to be converted, typically a string representation of a boolean such as 'true', 'yes', 'on', or '1'
tabledict = NoneA mapping of lowercase strings to boolean values used for lookup; defaults to a standard truthy/falsy table if not provided

Returns

TypeDescription
booleanThe boolean representation of the input term, or the original term if it is not a string