如何在python中打开网址 [英] how to open a url in python

查看:195
本文介绍了如何在python中打开网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

import urllib

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

但是,当example.com打开时,它不会呈现CSS或JS.如何在网络浏览器中打开网页?

But when example.com opens it does not render css or js. How can I open the webpage in a web browser?

@error(404)
def error404(error):
    return webbrowser.open('http://example.com')

我正在用瓶子.给我错误:TypeError("'bool' object is not iterable",)

I am using bottle. Giving me the error: TypeError("'bool' object is not iterable",)

推荐答案

>模块

import webbrowser

webbrowser.open('http://example.com')  # Go to example.com

这篇关于如何在python中打开网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆