Skip to main content

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


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.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

str2bool3-1.1.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file str2bool3-1.1.0.tar.gz.

File metadata

  • Download URL: str2bool3-1.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for str2bool3-1.1.0.tar.gz
Algorithm Hash digest
SHA256 638cf9b9e755f3e116b6b26b96fcb1bd8d5239bc5e7bfa1f7386d64eababfb37
MD5 8952097940fddfb1dbddfe1e27e7725e
BLAKE2b-256 addd055bd26a2a646b0eb7ce5317552b8224d1c39deee91f80ce7c640049634e

See more details on using hashes here.

File details

Details for the file str2bool3-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: str2bool3-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for str2bool3-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d09dc55f68a6fa5c97cadfe959bc1a77dc70700e7ceac184d1b7b70d066cd955
MD5 877172d5e0b633b602cab8fb52387475
BLAKE2b-256 44f7f1943fe478833c2735772f476966800a6bdaf1c040ef4914bc2020f53e47

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page