Convert string to boolean value using str_to_bool
function.
from str_to_bool import str_to_bool
# Convert string to boolean value
value = str_to_bool('true')
All values are case-insensitive. Any value not listed below will raise a ValueError
.
true
t
yes
y
on
1
false
f
no
n
off
0
pip install python-strtobool
poetry add python-strtobool
This project is released under the Apache-2.0 License. See the LICENSE file for more details.