机械化错误

2024-10-02 16:27:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我安装了python2.7,beauthulsoup和mechanize。我无法打开页面。我收到消息:

<response_seek_wrapper at 0x2d89348L whose wrapped object =<closeable_response at 0x2d89988Lwhose fp = <socket._fileobjectobject at 0x0000000002D4CE58>>>

代码如下:

^{pr2}$

我试着用谷歌搜索错误短信,但它找不到任何东西。好像是什么东西不见了,但我看了很多教程和论坛,他们只是使用开放的方法,而没有准备虚拟浏览器。我尝试了IDLE和commandprompt,但是得到了相同的消息。我的操作系统是Windows7。在

我错过了什么?在


Tags: 消息objectresponseseek页面socketwrapperat
1条回答
网友
1楼 · 发布于 2024-10-02 16:27:03

这并不意味着它不起作用。它打开页面并返回您不需要使用的response对象。只需在调用open()后继续使用br

>>> import mechanize
>>> br = mechanize.Browser()
>>> url = 'http://www.google.com'
>>> br.open(url)
<response_seek_wrapper at 0x11164ed88 whose wrapped object = <closeable_response at 0x111653320 whose fp = <socket._fileobject object at 0x111648250>>>
>>> br.title()
'Google'

相关问题 更多 >