float change from python 3.0.1 to 3.1.2
- by Jeremy
Im trying to learn python. I am using 3.1.2 and the o'reilly book is using 3.0.1
here is my code
import urllib.request
price = (99.99)
while price 4.74:
page = urllib.request.urlopen ("http://www.beans-r-us.biz/prices-loyalty.html")
text = page.read().decode("utf8")
where = text.find('>$')
start_of_price = where + 2
end_of_price = start_of_price + 6
price = float(text[start_of_price:end_of_price])
print ("Buy!")
-
here is my error
Traceback (most recent call last):
File "/Users/odin/Desktop/Coffe.py", line 14, in
price = float(text[start_of_price:end_of_price])
ValueError: invalid literal for float(): 4.59
what is wrong? please help!!