跳转到主要内容

在Python中轻松使用和操作具有单位意识的测量。

项目描述

https://travis-ci.org/coddingtonbear/python-measurement.svg?branch=master

在Python中轻松使用和操作具有单位意识的测量对象。

django.contrib.gis.measure 提供了这些神奇的‘Distance’对象,不仅可以用来自动存储单位感知的距离测量值,还可以在单位之间进行转换以及将对象相互之间进行加减。

此模块不仅提供了 Distance 和 Area 测量对象,还包括其他测量,例如:

  • 能量

  • 速度

  • 温度

  • 时间

  • 体积

  • 重量

示例

>>> from measurement.measures import Weight
>>> weight_1 = Weight(lb=125)
>>> weight_2 = Weight(kg=40)
>>> added_together = weight_1 + weight_2
>>> added_together
Weight(lb=213.184976807)
>>> added_together.kg  # Maybe I actually need this value in kg?
96.699
  • python-measurement的文档可在ReadTheDocs上找到。

  • 请将问题发布在Github上。

  • 测试状态可在Travis-CI上查看。

Bitdeli badge

支持者

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面