Jump to content

How to set this start in my Python WebCtach Project,I want it to continuly to catch the data i want.Thanks a lot!

Here is my project under bellow

import requests
import bs4
link="https://movie.douban.com/top250"
headers={"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.162 Safari/537.36"}
r=requests.get(link,headers=headers)
r.encoding="utf-8"
html=r.text
bs=bs4.BeautifulSoup(html,"html.parser")
div_lst=bs.find_all("div",{"class":"info"})
for span in div_lst:
    name=span.find("span",{"class":"title"}).string
    score=span.find("span",{"class":"rating_num"}).string
    if float(score)>9.5:
        print(name)
        print(score)
        print("------------------------------")

 

Link to comment
https://linustechtips.com/topic/1177108-study-discussion/
Share on other sites

Link to post
Share on other sites

4 minutes ago, Spirit`yL said:

BTW,My teacher only told us to catch three pages for homework

0_0 did you try googling it? 

I am NOT a professional and a lot of the time what I'm saying is based on limited knowledge and experience. I'm going to be incorrect at times. 

Motherboard Tier List                   How many watts do I need?
Best B550 Motherboards             Best Intel Z490 Motherboards

PC Troubleshooting                      You don't need a big PSU

PSU Tier List                                Common pc building mistakes 
PC BUILD Guide! (POV)              How to Overclock your CPU 

 

Link to comment
https://linustechtips.com/topic/1177108-study-discussion/#findComment-13474673
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×