The specific line is
b = int(a.translate(None, "\t<,"))
a is a string which contains "\t<56,000". When I print the result of the translate operation I get “56000”, but when it gets to the int() line, it gives me an error saying
ValueError: invalid literal for int() with base 10: ''
as if the string I gave it was null for some reason. Is there something I’m doing wrong? (also I’m reading the string in from a txt file if that changes anything)
Here is the source code: link
The problem is that in addition to all the strings you think you are getting, you also end up with a few strings consisting only of “\t”, which is then turned into empty strings by the string conversions.
Adding an additional clause to the if-test when testing for empty strings solves this:
instead of:
Also, consider using parenthesis for clarity…