I'm having trouble with this line of code in which I want to print the 4 stock prices for the companies listed. My issue is that, while there are no errors when I run it, the code only prints out empty brackets where the stock prices should go. This is the source of my confusion.
import urllib2
import re
symbolslist = ["aapl","spy","goog","nflx"]
i = 0
while i<len(symbolslist):
url = "http://money.cnn.com/quote/quote.html?symb=' +symbolslist[i] + '"
htmlfile = urllib2.urlopen(url)
htmltext = htmlfile.read()
regex = '<span stream='+symbolslist[i]+' streamformat="ToHundredth" streamfeed="SunGard">(.+?)</span>'
pattern = re.compile(regex)
price = re.findall(pattern,htmltext)
print "the price of", symbolslist[i], " is ", price
i+=1