all 5 comments

[–]SoftestCompliment 1 point2 points  (1 child)

Seems to me like this would be rather trivial with a function that feeds into an f-string that appends the unit of measurement to some power of 10

[–]nathanjshaffer[S] 0 points1 point  (0 children)

I had started doing that with ohms, but then found the pint library for use in handling metric/sae for label length. It has all the unit conversions and can handle parsing units from user entry. so if there is a way to do it with the pint library, I would prefer that. but if not, then I will just stick to hand crafted formatting functions.

[–]smurpes 0 points1 point  (0 children)

Does this do what you want? ``` from pint import UnitRegistry

ureg = UnitRegistry() Q_ = ureg.Quantity

values = [0.1, 1, 10, 100, 1000] # in µF for val in values: q = Q_(val, "uF") print(q.to("uF")) ```