Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用python在web浏览器中的特定超链接处打开html文件_Python_Python Webbrowser - Fatal编程技术网

使用python在web浏览器中的特定超链接处打开html文件

使用python在web浏览器中的特定超链接处打开html文件,python,python-webbrowser,Python,Python Webbrowser,我能够使用代码打开一个html文件 import webbrowser webbrowser.open_new_tab('file:///C:/filename.html') 我面临的问题是打开相同的html文件,但带有超链接 webbrowser.open_new_tab('file:///C:/filename.html#hyperlinkId') 这将在浏览器选项卡中打开文件,但不会根据需要移动到超链接 如果我错过了什么,请告诉我。 提前谢谢。@VipinJoshi:上面提到的链接只提

我能够使用代码打开一个html文件

import webbrowser
webbrowser.open_new_tab('file:///C:/filename.html')
我面临的问题是打开相同的html文件,但带有超链接

webbrowser.open_new_tab('file:///C:/filename.html#hyperlinkId')
这将在浏览器选项卡中打开文件,但不会根据需要移动到超链接

如果我错过了什么,请告诉我。
提前谢谢。

@VipinJoshi:上面提到的链接只提供了在浏览器中打开html文件的选项,这对我来说也很有用。问题是移动到超链接。@VipinJoshi问题已经使用了URL,因此我无法真正理解您的评论。另外,您的示例不包含锚点。