I am having a problem stripping commas out of a string while doing some web scraping. My code is as follows.
import urllib
import re
htmlfile = urllib.urlopen ("http://example.com")
htmltext = htmlfile.read ()
regex = 'Posts: (.+?)\n'
value = re.compile(regex)
posts = re.findall(value,htmltext)
print posts[0]
Now I am getting the data ok but the problem is the post count is coming down with commas with a value such as 1,092,391, and I want to strip the commas out to leave a number such as 1092391.
I've got Python 2.7.1 installed and nothing I've found on here or Google has seemed to work. I am a bit of a newbie though, so I am no doubt missing something so silly here but I do love to learn and get my hands dirty. So any help would be much appreciated.