Python中如何打开网页

幸好思念无声,可惜思念无声 ——24.6.4  Python打开前端网页 1.导入webbrowser库 用webbrowser.open(传入网址),打开网页 import webbrow

幸好思念无声,可惜思念无声

                                ——24.6.4 

Python打开前端网页

1.导入webbrowser

webbrowser.open(传入网址),打开网页

import webbrowser
webbrowser.open("Index.html")

2.用flask框架

from wsgiref.simple_server import make_server


def app(env, response):
    # "flask/django application"
    print("正在监听")
    response('200 OK', [("content-type", 'text/html')])  # 定义响应头
    return ['cuteboy']


# 初始化一个服务器
server = make_server('', 5100, app)
server.serve_forever(0.2)

点击网页链接即可打开

发布者:admin,转转请注明出处:http://www.yc00.com/web/1742569685a4460250.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信