Skip to main content

xiaojing

English | 中文

长度、质量与温度的单位换算。

安装

pip install xiaojing

用法

from xiaojing import convert

convert(1, "km", "m")        # 1000.0
convert(1, "mile", "km")     # 1.609344
convert(1, "kg", "lb")       # 2.204622...
convert(100, "c", "f")       # 212.0

说明

长度与质量走「先归一到基准单位再换算」,所以任意两个受支持单位之间都能互转;温度单独处理,因为它不是线性缩放而是带偏移。未知单位抛 KeyError,不做模糊匹配。

许可证

MIT


English

Convert units of length, mass and temperature.

Install

pip install xiaojing

Usage

from xiaojing import convert

convert(1, "km", "m")        # 1000.0
convert(1, "mile", "km")     # 1.609344
convert(1, "kg", "lb")       # 2.204622...
convert(100, "c", "f")       # 212.0

Notes

Length and mass convert through a base unit, so any supported pair works. Temperature is handled separately because it carries an offset, not just a scale. An unknown unit raises KeyError rather than being guessed.

License

MIT

Metadata

Release files for xiaojing 0.0.2

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

Source distribution (sdist)

Source distribution for xiaojing 0.0.2
File Size Uploaded Provenance
xiaojing-0.0.2.tar.gz 3.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for xiaojing 0.0.2
File Interpreter ABI Platform
xiaojing-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 7.4 kB

Release files / xiaojing-0.0.2.tar.gz

Download URL xiaojing-0.0.2.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1ee5d03706e8a234251b377e6074bd32edca1792cb0fb7f0485f122f9b6d2e20
BLAKE2b-256 checksum
How to use checksums
43aa51d569b33ec2c275811fae2ec3ead2b445f5686f2f0da2db066514bb7e29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Release files / xiaojing-0.0.2-py3-none-any.whl

Download URL xiaojing-0.0.2-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a16214fb723c9a8059f352c87807a199b27533256a0b3c081a8e13177c534a4
BLAKE2b-256 checksum
How to use checksums
38bb595281b606ff83f0fa9a86a4d20d9c25a988cd48d5e80e0591e010297199
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Security for xiaojing 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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