我是使用Python 3.6.4和RoboBrowser 0.5.3的初学者。 我保存了一些HTML网页,我试图在页面中获取信息。
很可能是错误的,我从similar question on beautifulSoup中获取灵感。 beautifulSoup解决方案适合我(BeautifulSoup 4.6.0)。
相比之下,基于roboBrowser的以下内容似乎不起作用:
from robobrowser import RoboBrowser
br = RoboBrowser(parser='html.parser')
br.open(open("my_file.html"))
有错误:
MissingSchema:无效的网址"< _io.TextIOWrapper 名称=' my_file.html' 模式=' R' encoding =' UTF-8'>":未提供架构。也许你的意思 HTTP://< _io.TextIOWrapper 名称=' my_file.html' 模式=' R'编码=' UTF-8'>
我知道代码需要一个基于http"的网址。我尝试过前置" file://"到我文件的绝对路径,无济于事。
有没有办法与库通信它是本地文件,或者这些功能可能不是roboBrowser的一部分?