Skip to main content

unit-convert

Easily convert units to different quantities.

For conveniance, abbreviations are accepted, where an attempt will be made to calculate the type based on the other inputs (eg. "m" can evaluate as either "minute" or "metre").

This library is deprecated: A recommendation is to use pint instead.

Example Usage

>>> from unit_convert import UnitConvert

# Yards + kilometres to miles
>>> UnitConvert(yards=136.23, kilometres=60)['miles']
37.35976780046479

# Bytes to terabytes
>>> UnitConvert('b', 19849347813875, 'megabytes', 512)['tb']
18.053364951617368

# List available conversions
>>> UnitConvert(metres=1).keys()
['nm', 'nanometres', 'μm', 'micrometres', 'mm', 'millimetres', 'cm', 'centimetres', 'i', 'inches', 'ft', 'feet', 'm', 'metres', 'meters', 'yd', 'yards', 'km', 'kilometres', 'kilometers', 'miles', 'lightyears', 'au', 'astronomical_units', 'parsec']

Data size, time, distance, mass and temperatures are supported.

Release files for unit-convert 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for unit-convert 1.2.0
File Size Uploaded
unit-convert-1.2.0.tar.gz 5.7 kB Details

Release files / unit-convert-1.2.0.tar.gz

Download URL unit-convert-1.2.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a9ba2af984a28f0bf55dfcb1f935eb9b6a0d9f94de650cf6b6b623f420802725
BLAKE2b-256 checksum
How to use checksums
030db19f969cf958cdaff72697cd6e89d5f6d03e396f5b06fa726cd44068d78d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

1.2.0 This release

1 release file

1.1.0

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page