From 1335bef6c3d0329678b2680dfc7435ad11db25df Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 22 Sep 2017 08:23:51 +0200 Subject: o EeVal: implememting unit parsing too. --- src/ee/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ee/__init__.py b/src/ee/__init__.py index b4da410..e48fa6a 100644 --- a/src/ee/__init__.py +++ b/src/ee/__init__.py @@ -43,7 +43,6 @@ class EeVal(object): return ((self._value, self._unit) < (other._value, other._unit)) def __str__(self): -# return str(self._value) + (" " + str(self._unit) if self._unit else "") return eng_str(self.__float__(), self._unit) def __float__(self): @@ -66,7 +65,8 @@ EeVal.exponents = { 'E': 18, } EeVal.units = ['F', 'Ohm', '\u2126', 'H'] -EeVal.r = re.compile("([0-9]+) *([" + "".join(EeVal.exponents.keys()) + "]?)(" + "|".join(EeVal.units) + "?)") +EeVal.r = re.compile("([0-9]+) *([" + "".join(EeVal.exponents.keys()) + "]?) *(" + "|".join(EeVal.units) + "?)") +print("EeVal.r={}".format(EeVal.r)) class LtSpiceRaw(object): -- cgit v1.2.3