我有一個Python文件html_gen.py
它寫一個新的html
文件index.html
在同一目錄下,並想開闢index.html
當書寫完成。webbrowser.open()在python
所以我寫了
import webbrowser
webbrowser.open("index.html");
但執行.py文件後沒有發生。如果我把代碼
webbrowser.open("http://www.google.com")
Safari執行代碼時將打開谷歌的FrontPage。
我不知道如何打開本地的index.html文件?
看到這個答案:http://stackoverflow.com/a/5943706/771848 – alecxe
DO如果你調用內建'open('index.html')',你會得到一個錯誤?它會檢查您是否可以打開文件進行閱讀。 – jfs
無法在Python 2.7.6,Ubuntu 14.04,Firefox 47上重現。 –