Cmag Cmag - 11 months ago 63
Python Question

Converting string to integer with python

When trying to convert a string into integer to be used as a variable later in the code, I get the following:

print int(urlsuccessful[i])

ValueError: invalid literal for int() with base 10: '2,919,247'

Answer Source

If only problems are commas, try:

>>> int("2,919,247".replace(",", ""))