[英]Python Webbrowser anchors on Local html file
When trying to to use '#' to specify anchor point in a webpage using the webbrowser lib, it seem to only work on websites, and not on local html files webbrowser.open(https://docs.python.org/library/webbrowser.html#webbrowser.open)
works, but webbrowser.open(file://C:\\path\\to\\webbrowser.html#webbrowser.open)
does not.当尝试使用“#”在使用 webbrowser lib 的网页中指定锚点时,它似乎只适用于网站,而不适用于本地 html 文件
webbrowser.open(https://docs.python.org/library/webbrowser.html#webbrowser.open)
有效,但webbrowser.open(file://C:\\path\\to\\webbrowser.html#webbrowser.open)
无效。
Is there something I am missing to be able to do it, or is it simply not supported?是否有什么我无法做到的,或者根本不支持? If so, are there any alternatives?
如果是这样,还有其他选择吗?
I need the html page to be available offline我需要 html 页面可以离线使用
Just do this -就这样做——
webbrowser.open_new(C:/path/to/webbrowser.html)
This will open html file offline这将离线打开 html 文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.