I am using beautifulsoup4 to extract prices tag from a website. The code i m using is this
#price
try:
price = soup.find('span',{'id':'actualprice'})
price_result= str(price.get_text())
print "Price: ",price_result
except StandardError as e:
price_result="Error was {0}".format(e)
print price_result
The output i m getting is a string with a format with commas in it. e.g.
82,000,00
What i want:
Change the format from string price to integer price without commas in it so that i can use them as values intead of strings in excel
You can do this :
>>> string = '82,000,00'
>>> int(price_result.replace(',', ''))
8200000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With