• 技术文章 >Python技术 >Python基础教程

    python redirect函数怎么用?

    十一十一2021-02-22 09:33:25原创5980

    本文教程操作环境: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')

    《相关推荐:php框架》

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

    专题推荐:redirect函数怎么用
    品易云
    上一篇:如何将python函数模块化? 下一篇:python函数超时怎么自动退出?

    相关文章推荐

    • python中如何应用视图函数?• 如何将python函数模块化?

    全部评论我要评论

    © 2021 Python学习网 苏ICP备2021003149号-1

  • 取消发布评论
  • 

    Python学习网