BeautifulSoup(html) not working, saying can't call module?

后端 未结 3 1468
无人共我
无人共我 2021-01-17 17:27
import urllib2
import urllib
from BeautifulSoup import BeautifulSoup        # html
from BeautifulSoup import BeautifulStoneSoup     # xml
import BeautifulSoup                


        
3条回答
  •  孤独总比滥情好
    2021-01-17 17:48

    @Blair's answer has the right slant but I'd perform some things slightly differently, i.e.:

    import BeautifulSoup
    Soup = BeautifulSoup.BeautifulSoup
    

    (recommended), or

    import BeautifulSoup
    from BeautifulSoup import BeautifulSoup as Soup
    

    (not bad either).

提交回复
热议问题