Why can't I scrape Amazon by BeautifulSoup?

前端 未结 4 2038
谎友^
谎友^ 2021-01-17 04:10

Here is my python code:

import urllib2
from bs4 import BeautifulSoup

page = urllib2.urlopen("http://www.amazon.com/")
soup = BeautifulSoup(page)
pr         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-17 04:42

    You can try this:

    import urllib2
    from bs4 import BeautifulSoup
    
    page = urllib2.urlopen("http://www.amazon.com/")
    soup = BeautifulSoup(page)
    print soup
    

    In python arbitrary text is called a string and it must be enclosed in quotes(" ").

提交回复
热议问题