how to open a url in python

后端 未结 7 1832
夕颜
夕颜 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:38

    You could also try:

    import os
    os.system("start \"\" http://example.com")
    

    This, other than @aaronasterling ´s answer has the advantage that it opens the default web browser. Be sure not to forget the "http://".

提交回复
热议问题