Units¶
Utility functions to convert values from one unit to another.
- benker.units.UNITS = {'cm': 0.01, 'dm': 0.1, 'ft': 0.3048, 'in': 0.0254, 'm': 1.0, 'mm': 0.001, 'pc': 0.0021166666666666664, 'pt': 0.00035277777777777776, 'px': 0.00035277777777777776}¶
Usual units Lengths in meter
- benker.units.convert_value(value, unit_in, unit_out)¶
Convert a value from one unit to another.
To convert ‘1pt’ to ‘mm’, you can do:
>>> from benker.units import convert_value >>> convert_value(1, 'pt', 'mm') 0.353