Linked Questions

Popular Questions

blank list error when taking data from web site

Asked by At

I have a problem on API. Its turns to me empty list

I tried to search browser but none is my answer.

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import urllib import re

site = "http://www.hurriyet.com.tr" 
regex = "<span class='news-title'>(.+?)</span>" 
comp = re.compile(regex) 
print(comp) print(regex) 
htmlkod = urllib.urlopen(site).read() 
titles = re.findall(regex, htmlkod) 
print(titles) 
i=1 
for title in titles:
        print str(i), title.decode("iso8859-9")
        print(title)
        i+=1

I Expect the its turn to me news titles but its turn me "[]" empty list

Related Questions