【发布时间】:2015-10-19 19:25:13
【问题描述】:
所以我正在尝试制作一个程序来告诉用户航海者 1 号离地球有多远,美国宇航局在他们的网站上有这个信息http://voyager.jpl.nasa.gov/where/index.html...
我似乎无法在 div 中获取信息,这是 div:<div id="voy1_km">Distance goes here</div>
我目前的程序如下:`
import requests
from BeautifulSoup import BeautifulSoup
url = "http://voyager.jpl.nasa.gov/where/index.html"
response = requests.get(url)
html = response.content
soup = BeautifulSoup(html)
test = soup.find('div', {'id' : 'voy1_km'})
print test
长话短说,我如何获取 div 内容?
【问题讨论】:
-
输出是什么?尝试打印响应 html 和汤,以检查它是否在任何地方中断
-
它只是输出...
-
查看来源, 里面什么都没有。 JS 提供变化的值
标签: html python-2.7