Skip to main content

convert any boolean-like value such as string, int, etc. to an actual bool

Project description

tobool

Convert many different representations of a bool to an actual bool or a None

Usage

pip install tobool

from tobool import to_bool

# Examples:
print(to_bool("True"))  # True
print(to_bool("False"))  # False
print(to_bool("Yes"))  # True
print(to_bool("T"))  # True
print(to_bool(1))  # True
print(to_bool("None"))  # None

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

tobool-0.4.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file tobool-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: tobool-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for tobool-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1b31c9ece9bad47e8a53e17bf0f38335570cb1d9576b2dc0d3df61bab4f1cb47
MD5 96be38a727934228afa8afbe475a0af4
BLAKE2b-256 f1f193f13ab26ebf609d980aeb8285f1d78c8f1f87727139e2d9a0181b01571a

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