来自使用Firefox的网站的BeautifulSoup和div值

Mez*_*ith 0 python beautifulsoup python-2.7

经过一些改变,我得到了:

import urllib2
from bs4 import BeautifulSoup

soup = BeautifulSoup(urllib2.urlopen("http://example.com"))

soup.find("div", {"id": "botloc"})

elem = soup.find('div')
print elem['id'], 'is the id'
print elem.text, 'is the value'
Run Code Online (Sandbox Code Playgroud)

所以最后我写了正确的代码(有论坛帮助),但回复的价值是错误的,因为它从谷歌chrome获取它!任何想法如何从Firefox获得div值?(我在firefox浏览器上的服务器上)我赞成每个提示

shx*_*hx2 5

你正在导入它,但你没有使用它......

soup = BeautifulSoup(urllib2.urlopen("http://www.example.com"))
Run Code Online (Sandbox Code Playgroud)