小编zez*_*ima的帖子

How to extract value from span tag

I am writing a simple web scraper to extract the game times for the ncaa basketball games. The code doesn't need to be pretty, just work. I have extracted the value from other span tags on the same page but for some reason I cannot get this one working.

from bs4 import BeautifulSoup as soup
import requests

url = 'http://www.espn.com/mens-college-basketball/game/_/id/401123420'
response = requests.get(url)
soupy = soup(response.content, 'html.parser')

containers = soupy.findAll("div",{"class" : "team-container"})
for container in containers:
    spans = container.findAll("span")
    divs …
Run Code Online (Sandbox Code Playgroud)

html python beautifulsoup web-scraping

5
推荐指数
1
解决办法
80
查看次数

标签 统计

beautifulsoup ×1

html ×1

python ×1

web-scraping ×1