嗨喽~大家好呀,这里是魔王呐 ❤ ~!

python更多源码/资料/解答/教程等 点击此处跳转文末名片免费获取
使用模块requests
方式代码如下:
import requests
url_string="http://******"
r = requests.head(url_string, stream=True)
print r.headers['Location']
Python自动处理301、302重定向
本文介绍了如何使用Python的requests模块处理HTTP的301和302重定向链接。通过设置allow_redirects属性,可以自动解析重定向链接,简化爬虫开发过程。

python更多源码/资料/解答/教程等 点击此处跳转文末名片免费获取
方式代码如下:
import requests
url_string="http://******"
r = requests.head(url_string, stream=True)
print r.headers['Location']

被折叠的 条评论
为什么被折叠?