Easily convert common strings to boolean
Project description
Booleanify
Inspired by Pydantic's boolean, Booleanify is a Python package that provides a simple utility for converting strings representing boolean values into actual boolean values.
Installation
You can install Booleanify using pip:
```bash pip install booleanify ```
Usage
To use Booleanify in your Python code, simply import the `booleanify` function and pass a string representing a boolean value to it. The function will return the corresponding boolean value.
```python from booleanify import booleanify
result = booleanify("T") print(result) # Output: True
result = booleanify("false") print(result) # Output: False ```
Booleanify supports the following string representations for boolean values:
Input | Output |
---|---|
1 | True |
'1' | True |
'on' | True |
't' | True |
'true' | True |
'y' | True |
'yes' | True |
0 | False |
'off' | False |
'f' | False |
'false' | False |
'n' | False |
'no' | False |
Contribution
If you have any suggestions, improvements, or issues regarding Booleanify, feel free to open an issue or submit a pull request on GitHub.
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
Built Distribution
Hashes for booleanify-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ceb72a421b89050c5ae873596f2394d9696c976b65b2904a8386b139062328b6 |
|
MD5 | 992171bc5c72557513aa30a7dac2d49d |
|
BLAKE2b-256 | 662bb935c13f7ca69a6993bc0aaa54239d894bb980eb1c47c819c66ecb0b857e |