What should I use to open a url instead of urlopen in urllib3

前端 未结 5 845
南方客
南方客 2021-01-30 08:29

I wanted to write a piece of code like the following:

from bs4 import BeautifulSoup
import urllib2

url = \'http://www.thefamouspeople.com/singers.php\'
html = u         


        
5条回答
  •  粉色の甜心
    2021-01-30 09:01

    With gazpacho you could pipeline the page straight into a parse-able soup object:

    from gazpacho import Soup
    url = "http://www.thefamouspeople.com/singers.php"
    soup = Soup.get(url)
    

    And run finds on top of it:

    soup.find("div")
    

提交回复
热议问题