您好,欢迎来到花图问答。
搜索
您的当前位置:首页python redirect函数怎么用?

python redirect函数怎么用?

来源:花图问答

 

本文教程操作环境:windows7系统、Python 3.9.1,DELL G3电脑。

描述:

跳转指定的url

语法:

redirect();

参数:

path

实例使用:

from flask import redirect
def redirect(path):
    header = 'HTTP/1.1 302 JUMP\r\nContent-Type: text/html\r\n'
    location = 'Location: {}'.format(path)
    response = header + location
return response.encode('utf-8')

上述我们可以获知信息,我们可以跳转到新的链接里,需要使用from flask import redirect导入,才可以正式进行函数的使用。

本文如未解决您的问题请添加抖音号:51dongshi(抖音搜索懂视),直接咨询即可。

热门图文

Copyright © 2019-2025 huatuowenda.com 版权所有 湘ICP备2023022495号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务