Convert string to boolean (Forked from SymonSoft/str2bool)
Project description
str2bool3 v1.0.0
About
Convert string to boolean.
The library recognizes "yes", "true", "y", "t", "1" as True, and "no", "false", "n", "f", "0" as False.
Case insensitive.
Installation
$ pip install str2bool3
Examples
Here's a basic example:
>>> from str2bool3 import StrUtils
>>> print(StrUtils.str2bool('Yes'))
True
To raise an exception on invalid input:
>>> from str2bool3 import StrUtils
>>> StrUtils.str2bool_exc('invalid')
ValueError: Invalid value 'invalid'. Expected one of: false, f, n, no, t, true, y, yes, 0, 1.
License
BSD
Forked from symonsoft/str2bool
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
str2bool3-1.3.0.tar.gz
(3.1 kB
view details)
Built Distribution
File details
Details for the file str2bool3-1.3.0.tar.gz
.
File metadata
- Download URL: str2bool3-1.3.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be4ddb470e0be4f34b731d10d2456366ffddaa5901fe97691404cbd117c1bf37 |
|
MD5 | a52e22486ee942abd8aa011e60ec0a51 |
|
BLAKE2b-256 | 7fb0b66457dd5622a1a72502a0d5bd5d2353a1b80a499c2205705a2c22589251 |
File details
Details for the file str2bool3-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: str2bool3-1.3.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e92413c16cbb3c1683047806dd14c3dea3b4cac00e61caaf6295f6d6d589f7c |
|
MD5 | 1508dbdf695c18a2a02dfc967504214a |
|
BLAKE2b-256 | 7d3f04c069128ea4296803f974b9464178ad7f2eb5c42f03ec77ec28efd9702e |