how to open a url in python

后端 未结 7 1791
夕颜
夕颜 2020-12-22 19:01
import urllib

fun open():
    return urllib.urlopen(\'http://example.com\')

But when example.com opens it does not render css or js. How can I ope

7条回答
  •  隐瞒了意图╮
    2020-12-22 19:46

    import webbrowser  
    webbrowser.open(url, new=0, autoraise=True)
    

    Display url using the default browser. If new is 0, the url is opened in the same browser window if possible. If new is 1, a new browser window is opened if possible. If new is 2, a new browser page (“tab”) is opened if possible. If autoraise is True, the window is raised

    webbrowser.open_new(url)
    

    Open url in a new window of the default browser

    webbrowser.open_new_tab(url)
    

    Open url in a new page (“tab”) of the default browser

提交回复
热议问题