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

前端 未结 5 737
南方客
南方客 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 08:50

    In urlip3 there's no .urlopen, instead try this:

    import requests
    html = requests.get(url)
    

提交回复
热议问题