#! /usr/bin/env python # encoding=utf8 import webbrowser import time webbrowser.open("http://www.baidu.com") # wait a while, and then go to another page time.sleep(5) webbrowser.open("http://www.taobao.com")
webbrowser 模塊提供了一個到系統標准 web 瀏覽器的接口. 它 提供了一個 open 函數, 接受文件名或 URL 作為參數, 然后在瀏覽器中打開它. 如果你又一次調用 open 函數, 那么它會嘗試在相同的窗口打開新頁面