redirect函数怎么用?【python redirect函数】

537次阅读
没有评论

redirect函数怎么用?【python

python redirect函数怎么用?

描述:

跳转指定的url

redirect函数语法:

redirect();

redirect函数参数:

path

redirect函数实例使用:

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导入,才可以正式进行函数的使用。

神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:wuyou2021-05-11发表,共计350字。
新手QQ群:570568346,欢迎进群讨论 Python51学习