TypeError:startfile:文件路径应该是字符串,字节或os.PathLike,而不是列表

时间:2020-08-08 17:04:27

标签: python browser

我的错误是:

  File "D:\script.py", line 53, in <module>
    webbrowser.open(website)
  File "C:\Users\Mitko\AppData\Local\Programs\Python\Python38-32\lib\webbrowser.py", line 86, in open
    if browser.open(url, new, autoraise):
  File "C:\Users\Mitko\AppData\Local\Programs\Python\Python38-32\lib\webbrowser.py", line 603, in open
    os.startfile(url)
TypeError: startfile: filepath should be string, bytes or os.PathLike, not list```

所以问题很简单,我该如何解决?

1 个答案:

答案 0 :(得分:0)

网站可以是网站=“ https://google.com”或网站=文件路径(字符串)。从该错误看来,网站已分配给列表。