Is there an API to get (value, prefix, unit) ? #1925
FabriceSalvaire
started this conversation in
General
Replies: 1 comment
-
You can do something like: >>> ureg.parse_unit_name("millisecond")
(('milli', 'second', ''),) It returns a list of triplets (prefix, unit, suffix). It is a list because sometimes multiple combinations could match, depending on the definition file. Do you need a custom formatter or a custom parser? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For a particular software (Spice), I need to know for a quantity, the float value, the prefix like pico nano etc., and the unit like meter.
It is because it is not case-sensitive, thus m and M means milli, and mega is Meg.
I could not find the API that permit to properly write a custom formatter.
Beta Was this translation helpful? Give feedback.
All reactions