0
点赞
收藏
分享

微信扫一扫

Python学习笔记(27)~爬虫基础学习:查看response中的一些返回值


查看response中的一些返回值

Demo

#!/usr/bin/python3
import urllib.request,urllib.error,urllib.parse

response=urllib.request.urlopen("http://www.baidu.com")
print("响应状态码:",response.status)#响应状态码
print("headers数据:",response.getheaders())
print("获取header中的Bdqid:",response.getheader("Bdqid"))#取出具体一个变量的值

运行结果

Python学习笔记(27)~爬虫基础学习:查看response中的一些返回值_python


举报

相关推荐

0 条评论