asbool is simple converter from str to bool.
use pip to install asbool.
pip install asbool
You can use asbool.asbool function simply.
>>> from asbool import asbool
>>> asbool('TRUE')
True
Or use AsBoolConverter instance with customized values.
>>> from asbool.converter import AsBoolConverter
>>> converter = AsBoolConverter(['t'], ['f'])
>>> converter('t')
True
>>> converter('f')
False
>>> converter('true')
Traceback (most recent call last):
...
raise ValueError(ss)
ValueError: true