4 ms·
This fix makes no sense: if is_hyphen(value[0]) and value[1] == "$": converted_value = float(re.sub(r"[^.0-9]", "", value)) \* -1 If the strategy is to
by devit 2y ago
This fix makes no sense:
if is_hyphen(value[0]) and value[1] == "$":
converted_value = float(re.sub(r"[^.0-9]", "", value)) \* -1
If the strategy is to delete all non-numeric characters in re.sub, you should instead replace _all_ characters that could be a minus with '-' before doing the float(re.sub(...)) including the '-' instead of this bizarre ad-hoc code.
Also "is_hyphen" is wrong since it doesn't handle the Unicode minus sign.