import requests


url = "https://www.baidu.com/s"
headers = {
    "User-Agent":"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36"
}
data = {
    "wd":"甲午中日战争什么时候开始"
}
res = requests.get(url=url,headers=headers,params=data)
res.encoding = "utf8"
html = res.text
anwsers = ["2333","1894"]
for i in range(len(anwsers)):
    anwsers[i] = (html.count(anwsers[i]),anwsers[i],i)

x = sorted(anwsers,key=lambda x:x[0],reverse=True)
print(x)

  

相关文章:

  • 2021-12-10
  • 2021-12-09
  • 2022-12-23
  • 2022-12-23
  • 2021-04-02
  • 2022-02-26
  • 2022-01-15
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2021-10-08
  • 2021-10-09
  • 2021-08-03
  • 2022-12-23
  • 2022-01-25
相关资源
相似解决方案