Reputation: 19
Result must include the delimiter.
Ex: a='1,000'
of type string and the output must be: a=1,000
as an integer.
Upvotes: 1
Views: 378
Reputation: 49
An integer won't include a comma. It's only for making the number readable that you add commas to it.
If you meant you want to parse the string into an integer, you should do the following:
num = int(a.replace(',', ''))
Afterwards if you want to present this integer with a comma again, you should just:
print "{:,}".format(num)
For back and fourth conversion in execution: Format and replace can help
Upvotes: 2