urllib - python can't read website html code -
i can't read html code of website using urllib
def tests(url): response = urllib.urlopen(url) soup = beautifulsoup(response.read()) universities=soup.findall('a',{'class':'pin-link'}) print universities if __name__ == '__main__': tests("https://pinshape.com/shop?page=3&is-free=true&type=-streamable")
you try using urllib.request. taking snippet of part of code using, works follows
import urllib.request urllib.request.urlopen('https://pinshape.com/shop?page=2') f: data = str(f.read()).replace('\n', '') myfile = open("testfile.txt", "r+") myfile.write(data)
Comments
Post a Comment