I'm working on pulling some stock quotes and I'm having trouble converting the string it returns to a float.
Here is the code:
a = urllib.urlopen("http://finance.yahoo.com/q;_ylt=AhPWqUh6C8Mq67175Sg2SyfxVax_;_ylu=X3oDMTFidmlsaThhBHBvcwMxMgRzZWMDeWZpU3ltYm9sTG9va3VwUmVzdWx0cwRzbGsDc3NubGY-?s=SSNLF")
b = a.read()
regex = '<span id="yfs_l84_ssnlf">(.+?)</span>'
pattern = re.compile(regex)
price = re.findall(pattern, str(b))
price = price[0]
@app.route('/test')
def test():
return price
Any help would be greatly appreciated, thank you!
[edit by admin: formatting]