Reputation: 15750
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'
Upvotes: 0
Views: 376
Reputation: 27216
If only problems are commas, try:
>>> int("2,919,247".replace(",", ""))
2919247
Upvotes: 3
Reputation: 1392
You can just do
def int2str(my_integer):
return "%d" % my_integer
Upvotes: -1
Reputation: 798436
locale.atoi()
will "demark" integers based on the current locale setting.
Upvotes: 4
Reputation: 56390
int
does not understand commas, you'll want to remove those before trying to convert
Upvotes: 1