Python type converter
Project description
TypePigeon
TypePigeon is a Python type converter focused on converting values between various Python data types.
pip install typepigeon
Usage
With TypePigeon, you can convert simple values from one type to another:
import typepigeon
typepigeon.convert_value(0.55, str)
# '0.55'
typepigeon.convert_value(1, float)
# 1.0
typepigeon.convert_value([1], str)
# '[1]'
Additionally, you can also cast values into a collection:
import typepigeon
typepigeon.convert_value([1, 2.0, '3'], [int])
# [1, 2, 3]
typepigeon.convert_value('[1, 2, 3]', (int, str, float))
# [1, '2', 3.0]
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
typepigeon-1.0.0.tar.gz
(5.8 kB
view details)
Built Distribution
File details
Details for the file typepigeon-1.0.0.tar.gz
.
File metadata
- Download URL: typepigeon-1.0.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b439f6ba0ad56e5c8230d2cc0009032b431ada7712f5c52ab06cf4b815c967b |
|
MD5 | 70b913e85e33cc7585f8a1f1122f59eb |
|
BLAKE2b-256 | d6684c1c1d0b6e5ae46c04b68e387d0dfefda1f4a1fe42efb946572cc654b9b3 |
File details
Details for the file typepigeon-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: typepigeon-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ad08560fe4866b57f370dc25730ada8ca104a450834b3892a120c095aae3d78 |
|
MD5 | bbda0a2465bf4d59ee2f6717e7c632dd |
|
BLAKE2b-256 | 71bb552946b2f87287ddaf4431a91a115685da4a46a6381b8ea9f667565a850b |