Skip to main content
 首页 » 编程设计

python之网络浏览器 'directory not found' 错误

2025年01月19日15cyq1162

我在 python 上的 webbrowser 模块中重复出现错误。每当我运行这个程序时,我都会遇到多个错误。

import webbrowser 
google_urls = ["www.gmail.com", "www.youtube.com"] 
def open_tabs(url_lists): 
    for url in url_lists: 
        webbrowser.open_new_tab(url) 
def main(): 
    webbrowser.open("www.google.com", new=2, autoraise=False) 
    open_tabs(google_urls) 
 
main() 

这些是我得到的错误: /home/garion/Documents/www.youtube.com:没有这样的文件或目录(还有 2 个,除了用于 www.google.com 和 www.gmail.com 之外都是一样的)

我正在使用 lubuntu、python IDLE 3.5 和 Chromium。

请您参考如下方法:

webbrowser.open('https://www.youtube.com') 

使用前面的https://。