Skip to main content

Python type converter

Project description

TypePigeon

tests codecov build version license style

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


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 hashes)

Uploaded Source

Built Distribution

typepigeon-1.0.0-py3-none-any.whl (5.8 kB view hashes)

Uploaded Python 3

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