could not convert string to float: price[0] - python : <p>I want to make a currency converter which will take the current exchange rate from yahoo and multiply it with the amount the user wants. But I cannot multiply them. Could you please help me?</p>

<p>I always get: 
Traceback (most recent call last):File "C:\Users\Ioannis\Desktop\c.py", line 17, in realprice = float("price[0]")</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code>import urllib
import re

stocklist = ["eurusd"]

i=0
while i&lt;len(stocklist):
    url = "http://finance.yahoo.com/q?s=eurusd=X"
    htmlfile = urllib.urlopen(url)
    htmltext = htmlfile.read()
    regex = '&lt;span id="yfs_l10_eurusd=x"&gt;(.+?)&lt;/span&gt;'
    pattern = re.compile(regex)
    price = re.findall(pattern,htmltext)
    print "the price of", stocklist[i],"is" ,price[0]
    i+=1

realprice = float("price[0]")

print ("Currency Exchange")
ex = raw_input("A-Euro to Dollars, B-Dollars to Euro")
if ex == "A":
    ptd = int(raw_input("How much would you like to convert: "))
    f = ptd*price[0]
    print("It is $",f)
if ex == "B":
    ptd = float(raw_input("How much would you like to convert"))
    f = ptd*0.7
    f2 = round(f,2)
    print ("It is $",f2)</code></pre>
</div>
</div>
</p>

<p>ValueError: could not convert string to float: price[0]</p>

<p><a href="http://i.stack.imgur.com/xsaXB.jpg" rel="nofollow">python code</a></p>
