我能否关闭使用以下代码打开的 Python 最后打开的选项卡(不关闭浏览器)?
import webbrowser
webbrowser.get("firefox").open_new_tab(url)
你可以为这个任务使用任何东西。我知道 webbrowser 模块无法做到这一点。
最佳答案
您可以使用此处的 pykeyboard
库发送热键组合以关闭选项卡 (Ctrl + W),https://github.com/SavinaRoja/PyUserInput .
关于python - 关闭上次打开的标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10449242/