Scrape of table with only 'div's

后端 未结 2 1093
迷失自我
迷失自我 2021-01-21 23:19

When trying to scrape a web page, this table has no tags, and is all

tags.

The site inspector that I\'m trying to scrape

2条回答
  •  执笔经年
    2021-01-21 23:52

    If you want the text from every table-row you can do this:

    import bs4
    import requests
    
    res = requests.get('https://www.nascar.com/results/race_center/2018/monster-energy-nascar-cup-series/auto-club-400/stn/race/')
    
    soup = bs4.BeautifulSoup(res.text, 'lxml')
    tds = soup.find_all('div', class_='table-row')
    for td in tds:
        print(td.text)
    

提交回复
热议问题