The output is: []
The import requests
The from bs4 import BeautifulSoup
Url="https://movie.douban.com/top250"
Hd={' the user-agent ':' Mozilla/5.0}
db_data=https://bbs.csdn.net/topics/requests.get (url, headers=hd)
Soup=BeautifulSoup (db_data. Text, 'LXML')
Titt=soup. Select (' div. Hd & gt; D ')
Print (titt)
CodePudding user response:
Find the problem titt=soup. Select (' div. Hd & gt; D) this code should be titt=soup. Select (' div. Hd & gt; A ')
CodePudding user response: