I have a dictionary "item":
>>> item["value"]
Out[2]: u'$26,420'
I want to convert this to the integer
26420
to load into a db. So far I've tried:
Out[2]: u'$26,420'
>>> item["value"][1:]
Out[3]: u'26,420'
>>> int(item["value"][1:])
Traceback (most recent call last):
File "F:\envs\virtalenvs\teat\lib\site-packages\IPython\core\interactiveshell.py", line 2885, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-4-cd6c9e68ae50>", line 1, in <module>
int(item["value"][1:])
ValueError: invalid literal for int() with base 10: '26,420'
Whats the best pythonic way to do this?