爬虫:使用Requests模块基本使用_response=requests.port(-程序员宅基地

技术标签: 爬虫  request  python  urllib  爬虫【python】  

 

目录

安装Requests

示例引入

GET请求

抓取网页

抓取二进制数据

 POST请求

常用的响应

我们了解urllib的基本用法,但是其中确实有不方便的地方,比如处理网页验证和 ookies时,需要写 Opener 和Handler来处理.。为了更加方便地实现这些操作,就有了更为强大的库request ,有了它, Cookies 、登录验证、代理设置等操作都不是事儿。

安装Requests

pin install requests

示例引入

import requests

response = requests.get("https://www.baidu.com")
print(type(response))
print(response.status_code)
print(type(response.text))
print(response.text)
print(response.cookies)

结果
<class 'requests.models.Response'>
200
<class 'str'>
<!DOCTYPE html>
<!--STATUS OK--><html> <head><meta http-equiv=content-type content=text/html;charset=utf-8><meta http-equiv=X-UA-Compatible content=IE=Edge> </div> </div> </div> </body> </html>

<RequestsCookieJar[<Cookie BDORZ=27315 for .baidu.com/>]>

这里我们调用 get() 方法实现与 urlopen() 相同的操作,得到一个 Response 对象,然后分别输出 Response 的类型、状态码、响应体的类型、以及内容 及Cookies

通过运行结果可以发现,它的返回类型是 requests.models .Response 响应体的类型是字符串str, Cookies 的类型是Req uestsCookieJar

GET请求

HTTP中最常见的请求之一就GET是请求,下面首先来详细了解一下利用 Requests 构建 GET 请求的方法
 

import requests

data = {
    "age":22,
    "name":"python"
}

reponse = requests.get("http://192.168.1.104/get",params=data)
print(type(reponse.text))
print(reponse.json())
print(type(reponse.json()))

结果:
<class 'str'>
{'args': {'age': '22', 'name': 'python'}, 'headers': {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'keep-alive', 'Host': '192.168.1.104', 'User-Agent': 'python-requests/2.25.1'}, 'origin': '192.168.1.101', 'url': 'http://192.168.1.104/get?age=22&name=python'}
<class 'dict'>

可以发现调用json()方法,就可以将返回结果是JSON格式的字符串转化为字典,但需要注意的是,如果返回结果不是 JSON 式,便会出现解析错误,抛出 json.decoder. JSONDecodeError 异常

抓取网页

上面的请求链接返回的是 JSON 形式的字符串, 那么如果请求普通的网页,则肯定能获得相应的内容了

import requests
import re

headers = {
    "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36"
}
reponse = requests.get("https://www.zhihu.com/explore",headers=headers)
pattern = re.compile('"ExploreSpecialCard-contentTitle".*?.data-za-detail-view-id="5794"*?>(.*?)</a>',re.S)
title = re.findall(pattern,reponse.text)
print(title)


结果:
['提示一:成为风险管理者', '时间旅人:上知乎的穿越者能透露一点未来的事吗?', '「保险」到底保险吗?', '【答案年终秀】本届天团向知乎网友问好', '你认为中国青年准备好走向世界舞台中央了吗?', '如何评价现在的大学生?', '哪些细思极恐的行为会让你感染HPV?', '哪些细思极恐的行为会让你感染HPV?', '接种 hpv 疫苗时,有哪些注意事项?', '长寿时代,不少人成了「困在长寿里的人」,该如何破局?', '健康问题让你对生活做出了哪些妥协?', '如何拥有一个充实而又愉快的老年生活?']

这样就可以提取其中的文本信息了

抓取二进制数据

在上面的例子中,我们抓取的是知乎的一个页面 实际上它返回的是 HTML 文档 如果想抓取图片、音频、 视频等文件,应该怎么办呢?

图片、音频、视频这些文件本质上都是由二进制码组成的,由于有特定的保存格式和对应的解析方式, 我们才可以看到这些形形色色的多媒体 所以,想要抓取它们,就要拿到它们的二进制码

import requests


headers = {
    "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36"
}
reponse = requests.get("https://static.zhihu.com/heifetz/favicon.ico",headers=headers)
print(reponse.text)
print(reponse.content)

结果;
           ¨     (       @                                     �e `�g Ώ�e ώ�f ��f ��f��f ��f ��f ��f ��f ��f ��f ��f ��fώ�f��f��e ��f ��fώ�g ώ�j��k ��lξ�o Ώ�q _                �` �f Ο�e ώ�f ��f ��e ώ�f ��f ��f ��f ��fώ�eώ�f��e ��fώ�f��f ��f ��f��f ��g��h ��i ��k ��l ��n ��p ��q ώ�t Ώ�p         �eΏ�eώ�f ��f ��f��f ��f ��f ��f ��f ��f ��f ��f ��g��f ��fώ�f ��f ��f ��g ��h ώ�j ��l ��lώ�n ��p ��r ��s ��u ��w Ο    �f _�f ��f ��fώ�f ��f ��f��f ��e ώ�f��fώ�e ώ�f ��eώ�e ώ�fώ�eώ�f ��f��g ��i ��j ��l ��n ��o ��p ��qώ�t ��u ��v ��x��y _�g Ώ�e ��f��f ��f ��f ��f ��f ��e ώ�e ώ�f ��f ��f��f ��f ��f ��f��g��g ��i ��k ��l ��n��oώ�p ώ�r��s ��u ώ�v ��x ��y ώ�{ Ώ�fξ�f��f ��e ώ�f���@���`���@��f ��e ώ�eώ�f��f ��e ώ�f ��e ώ�fώ�h ��i ��k ��lώ�m ώ�o ��qώ�s ��sώ�u ώ�v ��y ��z ��{ώ�}��f ��fώ�e ��f ��e ώ� `��υο������ΨΏ��y ώ�f ��f ��f��e ώ�f��Ε ��h ��j��k ��lώ�Ι ��”@��q ��s ��t ��v��w ��x ώ�z ��{ ��}ώ� ��e ώ�f��f ��f ��f ��f ��‚0��υο������μί��f ��fώ�e ώ�f ��p������s��l ��m ��n ��φο������Β���}��uώ�x ��y ��z ώ�|��}ώ�€��€ ��f ��f ώ�f ��f ��f ��f ��f ���`����������³€ώ�eώ�f ��z!��υο������~ ��¤`��������������������������������������| ώ�~��€ ��€ ώ�‚ ώ�e ώ�f ��f��f��e ��f��fώ�f ��Ε ������μί��y ��g ��ΩΏ������ΪΏ��m��¥`��������������—@��Υ―������������������~ ��€��€ώ�‚ ώ�„��f ��f ��f ��f ��f ��f ��f��fώ�x!ώ���������΅`��¬pώ�����φο��€ ώ�o ώ�¦`������άΏ��u ��vώ�x ��z ��‹ ����������€ ���ώ�‚ώ�„ ��… ��f ��f ��e ώ�f��g��f ��eώ�f ��f ��Ζ ������ΪΏ��μί������p��p ��q ��§`������έΏ��w ώ�y ��yώ�| ���!ώ���������‚ ��ƒ ��… ��† ��� ��fώ�f ��f ��f ��f ��f��e ώ�f ��g ���@ώ�����φο�� ��ΐ���p ��qώ�s ��¨`������ήΏ��y ��z ώ�|��~��� ����������ƒ ��… ��‡�����‰ ��fώ�f ��f ��f ��f��f ��f ��f ώ�hώ�j ��φο������‰1ώ�p��q ��s ��tώ�`������ήΏ��{��}��} ώ� ��‘!ώ���������…��‡���ώ�� ���ώ�f��fώ�fώ�f ��f��p��z!ώ�{ ώ�} ��~ ��δΟ�������P��qώ�s ��u ��v ��«aώ�����ήΏ��} ��~ �� ��€ώ�’ ����������‡ ��‰��‰ ώ�‹ ώ��ώ�f ��f��fώ�f ��fώ�½�������������������������������������������ξί��­`ώ�����ίΏ��~��€ώ�� ��ƒ ��” ����������‰������������ ��f ��f��fώ�f ��h ��| ��ΪΏ��μί��νί��νί��φο������χο��ξί��ξί��οί��Ξ���­`������ίΏ��€��� ��ƒ ��„ ώ�• ����������‹��� ������ ��‘ ώ�f��f ��g ��i ��i ��k ��m��n ώ�p ��q ��Ή€������Λ���w ��y��z ώ�{ ��`������ΰΏ��‚ ��ƒώ�… ��†ώ�—!ώ���������� ώ�� ��� ��‘ ��“ώ�f ��g ��i��j ��l ��m ��o ��p ��r ��s ��Ή€������Μ���y ��{��| ��~ ��―`������ΰΏ��„ ��… ��‡ ��‡ώ�� ����������� ��� ώ�‘��“ώ�” ��g ��i��jώ�lώ�m ��›P��―pώ�zώ�t��u ��Ί€������Ν���{ ��|ώ�~ ��€ ��°a������ΰΏ��… ��‡ ώ�� ���ώ�� ����������� ��’ ��“ ��” ��— ώ�i ��j ��l ��m ��o ��”@������ξί��‡ ��w��Ό€������Ξ���| ��~ ��€ ��� ��±`������ΰΏ�����‰ ��� �����› ����������’��“��• ��—ώ�� ��j ώ�m��n��p��q ��r ��άΏ������Γ���xώ�Ό€������Ο���~ ��€��� ��ƒώ�²`������αΏ��‰��� ��� ��� ��� ����������”��• ��—ώ�� ��� ��lώ�nώ�p ��q ��s ��t ώ�`������χο��ήΏ��οί������χο��ίΏ��ίΏ��ίΏ��³`��³a������χο��αΏ��γΏ��γΏ��γΏ��γΏ����������• ��— ώ�� ��� ��› ��n ��p ��q ��s ώ�u ��v ��� ��������������������������������������΄`��΄`��������������������������������������� ώ���� ��� �����q ��qώ�s ��u ��v ��x ��yώ�Φ―������Η��� @ώ�΅@��΅@��£@ώ�¤@��¥@��‰��‘��@���@��«@��¬@��­@��@��―@��°@��²@�� ��› ώ����� ώ�� ��r ��t��u ��v ��xώ�y ώ�{��­`������ηΟ��� ��‚ ��…��†��‡ ώ�‰ ��� ώ�� ��� ��� ��� ��’ώ�“ ��–ώ�– ��� ��� ώ�› ������ ώ�� ��΅ ��t ��u��w ��x ��z��{ ��} �� ��·p��χο��“ ώ�„ ��… ��‡ ��� ώ�‹ ������ ��� ��‘��’��” ��• ��—ώ��ώ�� ��›������ ��  ώ�΅ ��£ ο�wΏ�w ��y ��zώ�{ ��} �� ��€ ��‚��„ ��… ��† ώ�‡ώ�‰ ��‹ώ�� ���ώ�� ��‘ώ�“ ��•ώ�• ��— ��� ��� ������ �����  ��Ά��£��¤ Ώ�x `�y��z ��|��~��€ ��€ ��‚��ƒ ��… ώ�†��� ��� ��‹��� ��� ��� ��‘ ��“ ��• ��–ώ�— �� ��› ώ��ώ����� ��  ��Ά��£ ��¥ ��¦ _    �zΟ�| ��~ώ�€��� ��‚��ƒώ�†��† ώ��ώ��ώ�‹ώ�� ��� ώ�� ώ�‘ ��“ ώ�• ��— ώ�— �� ��� ��� ���ώ�� ��΅ ��Ά��¤ώ�¥ ��§ Ώ        �€ �} Ώ�€ώ�� ��ƒ ��„ώ�… ��‡��‰��� ��‹ ���ώ�� ��� ��’ώ�” ώ�” ��– ��� �� ��› ��� ��� �����΅��Ά��£ ��¥ ��§ Ο��                 �� _�ƒ Ώ�„ ο�… ώ�‡ ��‰ώ�� ��� ��� ���ώ�� ��’��”��• ��— ��� ���ώ�› ���ώ�� ��� ��΅ ��£��¤ ��¥ Ώ�¦ _            ΰ  €  €                                                                                                          €  €  ΰ  
b'\x00\x00\x01\x00\x01\x00  \x00\x00\x01\x00 \x00\xa8\x10\x00\x00\x16\x00\x00\x00(\x00\x00\x00 \x00\x00\x00@\x00\x00\x00\x01\x00 \x00\x00\x00\x00\x00\x00\x10\x00\x00\x13\x0b\x00\x00\x13\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xffe\x00`\xffg\x00\xbf\xffe\x00\xfe\xfff\x00\xff\xfff\x00\xff\xfff\x01\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x01\xfe\xfff\x01\xff\xfff\x01\xff\xffe\x00\xff\xfff\x00\xff\xfff\x01\xfe\xffg\x00\xfe\xffj\x01\xff\xffk\x00\xff\xffl\x01\xee\xffo\x00\xbf\xffq\x00_\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff`\x00\x10\xfff\x00\xcf\xffe\x00\xfe\xfff\x00\xff\xfff\x00\xff\xffe\x00\xfe\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x01\xfe\xffe\x01\xfe\xfff\x01\xff\xffe\x00\xff\xfff\x01\xfe\xfff\x01\xff\xfff\x00\xff\xfff\x00\xff\xfff\x01\xff\xfff\x00\xff\xffg\x01\xff\xffh\x00\xff\xffi\x00\xff\xffk\x00\xff\xffl\x00\xff\xffn\x00\xff\xffp\x00\xff\xffq\x00\xfe\xfft\x00\xbf\xffp\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\xffe\x01\xbf\xffe\x01\xfe\xfff\x00\xff\xfff\x00\xff\xfff\x01\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xffg\x01\xff\xfff\x00\xff\xfff\x01\xfe\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xffg\x00\xff\xffh\x00\xfe\xffj\x00\xff\xffl\x00\xff\xffl\x01\xfe\xffn\x00\xff\xffp\x00\xff\xffr\x00\xff\xffs\x00\xff\xffu\x00\xff\xffw\x00\xcf\x00\x00\x00\x00\xfff\x00_\xfff\x00\xff\xfff\x00\xff\xfff\x01\xfe\xfff\x00\xff\xfff\x00\xff\xfff\x01\xff\xfff\x00\xff\xffe\x00\xfe\xfff\x01\xff\xfff\x01\xfe\xffe\x00\xfe\xfff\x00\xff\xffe\x01\xfe\xffe\x00\xfe\xfff\x01\xfe\xffe\x01\xfe\xfff\x00\xff\xfff\x01\xff\xffg\x00\xff\xffi\x00\xff\xffj\x00\xff\xffl\x00\xff\xffn\x00\xff\xffo\x00\xff\xffp\x00\xff\xffq\x01\xfe\xfft\x00\xff\xffu\x00\xff\xffv\x00\xff\xffx\x01\xff\xffy\x00_\xffg\x00\xbf\xffe\x00\xff\xfff\x01\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xffe\x00\xfe\xffe\x00\xfe\xfff\x00\xff\xfff\x00\xff\xfff\x01\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x01\xff\xffg\x01\xff\xffg\x00\xff\xffi\x00\xff\xffk\x00\xff\xffl\x00\xff\xffn\x01\xff\xffo\x01\xfe\xffp\x00\xfe\xffr\x01\xff\xffs\x00\xff\xffu\x00\xfe\xffv\x00\xff\xffx\x00\xff\xffy\x00\xfe\xff{\x00\xbf\xfff\x01\xee\xfff\x01\xff\xfff\x00\xff\xffe\x00\xfe\xfff\x01\xff\xff\x8d@\xff\xff\x9f`\xff\xff\x8c@\xff\xfff\x00\xff\xffe\x00\xfe\xffe\x01\xfe\xfff\x01\xff\xfff\x00\xff\xffe\x00\xfe\xfff\x00\xff\xffe\x00\xfe\xfff\x01\xfe\xffh\x00\xff\xffi\x00\xff\xffk\x00\xff\xffl\x01\xfe\xffm\x00\xfe\xffo\x00\xff\xffq\x01\xfe\xffs\x00\xff\xffs\x01\xfe\xffu\x00\xfe\xffv\x00\xff\xffy\x00\xff\xffz\x00\xff\xff{\x01\xfe\xff}\x01\xff\xfff\x00\xff\xfff\x01\xfe\xffe\x00\xff\xfff\x00\xff\xffe\x00\xfe\xff\xa0`\xff\xff\xf5\xef\xff\xff\xff\xff\xff\xff\xd8\xbf\xff\xffy \xfe\xfff\x00\xff\xfff\x00\xff\xfff\x01\xff\xffe\x00\xfe\xfff\x01\xff\xff\xc5\xa0\xff\xffh\x00\xff\xffj\x01\xff\xffk\x00\xff\xffl\x01\xfe\xff\xc9\xa0\xff\xff\x94@\xff\xffq\x00\xff\xffs\x00\xff\xfft\x00\xff\xffv\x01\xff\xffw\x00\xff\xffx\x00\xfe\xffz\x00\xff\xff{\x00\xff\xff}\x01\xfe\xff\x7f\x00\xff\xffe\x00\xfe\xfff\x01\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xff\x820\xff\xff\xf5\xef\xff\xff\xff\xff\xff\xff\xec\xdf\xff\xfff\x00\xff\xfff\x01\xfe\xffe\x00\xfe\xfff\x00\xff\xff\xa9p\xff\xff\xff\xff\xff\xffs\x10\xff\xffl\x00\xff\xffm\x00\xff\xffn\x00\xff\xff\xf6\xef\xff\xff\xff\xff\xff\xff\xc2\x90\xff\xff}\x11\xff\xffu\x01\xfe\xffx\x00\xff\xffy\x00\xff\xffz\x00\xfe\xff|\x01\xff\xff}\x01\xfe\xff\x80\x01\xff\xff\x80\x00\xff\xfff\x00\xff\xfff\x00\xfe\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xff\x9f`\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xb3\x80\xfe\xffe\x01\xfe\xfff\x00\xff\xffz!\xff\xff\xf5\xef\xff\xff\xff\xff\xff\xff~ \xff\xff\xa4`\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff|\x00\xfe\xff~\x01\xff\xff\x80\x00\xff\xff\x80\x00\xfe\xff\x82\x00\xfe\xffe\x00\xfe\xfff\x00\xff\xfff\x01\xff\xfff\x01\xff\xffe\x00\xff\xfff\x01\xff\xfff\x01\xfe\xfff\x00\xff\xff\xc5\xa0\xff\xff\xff\xff\xff\xff\xec\xdf\xff\xffy \xff\xffg\x00\xff\xff\xd9\xbf\xff\xff\xff\xff\xff\xff\xda\xbf\xff\xffm\x01\xff\xff\xa5`\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x97@\xff\xff\xd5\xaf\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff~\x00\xff\xff\x80\x01\xff\xff\x80\x01\xfe\xff\x82\x00\xfe\xff\x84\x01\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x01\xff\xfff\x01\xfe\xffx!\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xa1`\xff\xff\xacp\xfe\xff\xff\xff\xff\xff\xf6\xef\xff\xff\x80 \xfe\xffo\x00\xfe\xff\xa6`\xff\xff\xff\xff\xff\xff\xdc\xbf\xff\xffu\x00\xff\xffv\x01\xfe\xffx\x00\xff\xffz\x00\xff\xff\x8b \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x80\x00\xff\xff\x81\x01\xfe\xff\x82\x01\xfe\xff\x84\x00\xff\xff\x85\x00\xff\xfff\x00\xff\xfff\x00\xff\xffe\x00\xfe\xfff\x01\xff\xffg\x01\xff\xfff\x00\xff\xffe\x01\xfe\xfff\x00\xff\xfff\x00\xff\xff\xc6\xa0\xff\xff\xff\xff\xff\xff\xda\xbf\xff\xff\xec\xdf\xff\xff\xff\xff\xff\xff\xaep\xff\xffp\x00\xff\xffq\x00\xff\xff\xa7`\xff\xff\xff\xff\xff\xff\xdd\xbf\xff\xffw\x00\xfe\xffy\x00\xff\xffy\x01\xfe\xff|\x00\xff\xff\x8d!\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\x82\x00\xff\xff\x83\x00\xff\xff\x85\x00\xff\xff\x86\x00\xff\xff\x88\x00\xff\xfff\x01\xfe\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x01\xff\xffe\x00\xfe\xfff\x00\xff\xffg\x00\xff\xff\x8e@\xfe\xff\xff\xff\xff\xff\xf6\xef\xff\xff\x7f \xff\xff\xc0\x90\xff\xffp\x00\xff\xffq\x01\xfe\xffs\x00\xff\xff\xa8`\xff\xff\xff\xff\xff\xff\xde\xbf\xff\xffy\x00\xff\xffz\x00\xfe\xff|\x01\xff\xff~\x01\xff\xff\x8f \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x83\x00\xff\xff\x85\x00\xff\xff\x87\x01\xff\xff\x88\x01\xff\xff\x89\x00\xff\xfff\x01\xfe\xfff\x00\xff\xfff\x00\xff\xfff\x00\xff\xfff\x01\xff\xfff\x00\xff\xfff\x00\xff\xfff\x00\xfe\xffh\x01\xfe\xffj\x00\xff\xff\xf6\xef\xff\xff\xff\xff\xff\xff\x891\xfe\xffp\x01\xff\xffq\x00\xff\xffs\x00\xff\xfft\x01\xfe\xff\xa9`\xff\xff\xff\xff\xff\xff\xde\xbf\xff\xff{\x01\xff\xff}\x01\xff\xff}\x00\xfe\xff\x7f\x00\xff\xff\x91!\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\x85\x01\xff\xff\x87\x01\xff\xff\x88\x01\xfe\xff\x8a\x00\xff\xff\x8a\x01\xfe\xfff\x01\xff\xfff\x01\xfe\xfff\x01\xfe\xfff\x00\xff\xfff\x01\xff\xffp\x10\xff\xffz!\xfe\xff{ \xfe\xff} \xff\xff~ \xff\xff\xe4\xcf\xff\xff\xff\xff\xff\xff\x9dP\xff\xffq\x01\xfe\xffs\x00\xff\xffu\x00\xff\xffv\x00\xff\xff\xaba\xfe\xff\xff\xff\xff\xff\xde\xbf\xff\xff}\x00\xff\xff~\x00\xff\xff\x7f\x00\xff\xff\x80\x01\xfe\xff\x92 \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x87\x00\xff\xff\x89\x01\xff\xff\x89\x00\xfe\xff\x8b\x00\xfe\xff\x8d\x01\xfe\xfff\x00\xff\xfff\x01\xff\xfff\x01\xfe\xfff\x00\xff\xfff\x01\xfe\xff\xbd\x90\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xee\xdf\xff\xff\xad`\xfe\xff\xff\xff\xff\xff\xdf\xbf\xff\xff~\x01\xff\xff\x80\x01\xfe\xff\x81\x00\xff\xff\x83\x00\xff\xff\x94 \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x89\x01\xff\xff\x8a\x01\xff\xff\x8c\x01\xff\xff\x8e\x01\xff\xff\x8f\x00\xff\xfff\x00\xff\xfff\x01\xff\xfff\x01\xfe\xfff\x00\xff\xffh\x00\xff\xff| \xff\xff\xda\xbf\xff\xff\xec\xdf\xff\xff\xed\xdf\xff\xff\xed\xdf\xff\xff\xf6\xef\xff\xff\xff\xff\xff\xff\xf7\xef\xff\xff\xee\xdf\xff\xff\xee\xdf\xff\xff\xef\xdf\xff\xff\xce\x9f\xff\xff\xad`\xff\xff\xff\xff\xff\xff\xdf\xbf\xff\xff\x80\x01\xff\xff\x81\x00\xff\xff\x83\x00\xff\xff\x84\x00\xfe\xff\x95 \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x8b\x01\xff\xff\x8c\x00\xff\xff\x8e\x01\xff\xff\x8f\x00\xff\xff\x91\x00\xfe\xfff\x01\xff\xfff\x00\xff\xffg\x00\xff\xffi\x00\xff\xffi\x00\xff\xffk\x00\xff\xffm\x01\xff\xffn\x00\xfe\xffp\x00\xff\xffq\x00\xff\xff\xb9\x80\xff\xff\xff\xff\xff\xff\xcb\x9f\xff\xffw\x00\xff\xffy\x01\xff\xffz\x00\xfe\xff{\x00\xff\xff\xae`\xff\xff\xff\xff\xff\xff\xe0\xbf\xff\xff\x82\x00\xff\xff\x83\x01\xfe\xff\x85\x00\xff\xff\x86\x01\xfe\xff\x97!\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\x8c\x00\xfe\xff\x8e\x00\xff\xff\x8f\x00\xff\xff\x91\x00\xff\xff\x93\x01\xfe\xfff\x00\xff\xffg\x00\xff\xffi\x01\xff\xffj\x00\xff\xffl\x00\xff\xffm\x00\xff\xffo\x00\xff\xffp\x00\xff\xffr\x00\xff\xffs\x00\xff\xff\xb9\x80\xff\xff\xff\xff\xff\xff\xcc\x9f\xff\xffy\x00\xff\xff{\x01\xff\xff|\x00\xff\xff~\x00\xff\xff\xaf`\xff\xff\xff\xff\xff\xff\xe0\xbf\xff\xff\x84\x00\xff\xff\x85\x00\xff\xff\x87\x00\xff\xff\x87\x01\xfe\xff\x98 \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x8f\x00\xff\xff\x90\x00\xfe\xff\x91\x01\xff\xff\x93\x01\xfe\xff\x94\x00\xff\xffg\x00\xff\xffi\x01\xff\xffj\x01\xfe\xffl\x01\xfe\xffm\x00\xff\xff\x9bP\xff\xff\xafp\xfe\xffz\x11\xfe\xfft\x01\xff\xffu\x00\xff\xff\xba\x80\xff\xff\xff\xff\xff\xff\xcd\x9f\xff\xff{\x00\xff\xff|\x01\xfe\xff~\x00\xff\xff\x80\x00\xff\xff\xb0a\xff\xff\xff\xff\xff\xff\xe0\xbf\xff\xff\x85\x00\xff\xff\x87\x00\xfe\xff\x88\x00\xff\xff\x8a\x01\xfe\xff\x9a \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x90\x00\xff\xff\x92\x00\xff\xff\x93\x00\xff\xff\x94\x00\xff\xff\x97\x00\xfe\xffi\x00\xff\xffj\x00\xff\xffl\x00\xff\xffm\x00\xff\xffo\x00\xff\xff\x94@\xff\xff\xff\xff\xff\xff\xee\xdf\xff\xff\x87 \xff\xffw\x01\xff\xff\xbc\x80\xff\xff\xff\xff\xff\xff\xce\x9f\xff\xff|\x00\xff\xff~\x00\xff\xff\x80\x00\xff\xff\x81\x00\xff\xff\xb1`\xff\xff\xff\xff\xff\xff\xe0\xbf\xff\xff\x88\x01\xff\xff\x89\x00\xff\xff\x8a\x00\xff\xff\x8c\x01\xff\xff\x9b \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x92\x01\xff\xff\x93\x01\xff\xff\x95\x00\xff\xff\x97\x01\xfe\xff\x98\x00\xff\xffj\x00\xfe\xffm\x01\xff\xffn\x01\xff\xffp\x01\xff\xffq\x00\xff\xffr\x00\xff\xff\xdc\xbf\xff\xff\xff\xff\xff\xff\xc3\x90\xff\xffx\x01\xfe\xff\xbc\x80\xff\xff\xff\xff\xff\xff\xcf\x9f\xff\xff~\x00\xff\xff\x80\x01\xff\xff\x81\x00\xff\xff\x83\x01\xfe\xff\xb2`\xff\xff\xff\xff\xff\xff\xe1\xbf\xff\xff\x89\x01\xff\xff\x8a\x00\xff\xff\x8c\x00\xff\xff\x8e\x00\xff\xff\x9d \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x94\x01\xff\xff\x95\x00\xff\xff\x97\x01\xfe\xff\x98\x00\xff\xff\x9a\x00\xff\xffl\x01\xfe\xffn\x01\xfe\xffp\x00\xff\xffq\x00\xff\xffs\x00\xff\xfft\x00\xfe\xff\xa9`\xff\xff\xff\xff\xff\xff\xf7\xef\xff\xff\xde\xbf\xff\xff\xef\xdf\xff\xff\xff\xff\xff\xff\xf7\xef\xff\xff\xdf\xbf\xff\xff\xdf\xbf\xff\xff\xdf\xbf\xff\xff\xb3`\xff\xff\xb3a\xff\xff\xff\xff\xff\xff\xf7\xef\xff\xff\xe1\xbf\xff\xff\xe3\xbf\xff\xff\xe3\xbf\xff\xff\xe3\xbf\xff\xff\xe3\xbf\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x95\x00\xff\xff\x97\x00\xfe\xff\x98\x00\xff\xff\x9a\x00\xff\xff\x9b\x00\xff\xffn\x00\xff\xffp\x00\xff\xffq\x00\xff\xffs\x00\xfe\xffu\x00\xff\xffv\x00\xff\xff\x88 \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xb4`\xff\xff\xb4`\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x98\x00\xfe\xff\x99\x01\xff\xff\x9a\x00\xff\xff\x9c\x00\xff\xff\x9e\x01\xff\xffq\x00\xff\xffq\x01\xfe\xffs\x00\xff\xffu\x00\xff\xffv\x00\xff\xffx\x00\xff\xffy\x01\xfe\xff\xd6\xaf\xff\xff\xff\xff\xff\xff\xc7\x90\xff\xff\xa0@\xfe\xff\xa1@\xff\xff\xa1@\xff\xff\xa3@\xfe\xff\xa4@\xff\xff\xa5@\xff\xff\x89\x01\xff\xff\x91\x11\xff\xff\xa9@\xff\xff\xaa@\xff\xff\xab@\xff\xff\xac@\xff\xff\xad@\xff\xff\xae@\xff\xff\xaf@\xff\xff\xb0@\xff\xff\xb2@\xff\xff\x99\x00\xff\xff\x9b\x00\xfe\xff\x9c\x01\xff\xff\x9e\x00\xfe\xff\x9f\x00\xff\xffr\x00\xff\xfft\x01\xff\xffu\x00\xff\xffv\x00\xff\xffx\x01\xfe\xffy\x00\xfe\xff{\x01\xff\xff\xad`\xff\xff\xff\xff\xff\xff\xe7\xcf\xff\xff\x81\x00\xff\xff\x82\x00\xff\xff\x85\x01\xff\xff\x86\x01\xff\xff\x87\x00\xfe\xff\x89\x00\xff\xff\x8a\x00\xfe\xff\x8c\x00\xff\xff\x8d\x00\xff\xff\x8f\x00\xff\xff\x90\x00\xff\xff\x92\x01\xfe\xff\x93\x00\xff\xff\x96\x01\xfe\xff\x96\x00\xff\xff\x98\x00\xff\xff\x9a\x00\xfe\xff\x9b\x00\xff\xff\x9d\x01\xff\xff\x9e\x00\xfe\xff\x9f\x00\xff\xff\xa1\x00\xff\xfft\x00\xff\xffu\x01\xff\xffw\x00\xff\xffx\x00\xff\xffz\x01\xff\xff{\x00\xff\xff}\x00\xff\xff\x7f\x00\xff\xff\xb7p\xff\xff\xf7\xef\xff\xff\x93 \xfe\xff\x84\x00\xff\xff\x85\x00\xff\xff\x87\x00\xff\xff\x88\x00\xfe\xff\x8b\x00\xff\xff\x8c\x01\xff\xff\x8d\x00\xff\xff\x8f\x00\xff\xff\x91\x01\xff\xff\x92\x01\xff\xff\x94\x00\xff\xff\x95\x00\xff\xff\x97\x01\xfe\xff\x98\x01\xfe\xff\x9a\x00\xff\xff\x9b\x01\xff\xff\x9d\x01\xff\xff\x9e\x00\xff\xff\xa0\x00\xfe\xff\xa1\x00\xff\xff\xa3\x00\xef\xffw\x01\xbf\xffw\x00\xff\xffy\x00\xff\xffz\x01\xfe\xff{\x00\xff\xff}\x00\xff\xff\x7f\x00\xff\xff\x80\x00\xff\xff\x82\x01\xff\xff\x84\x00\xff\xff\x85\x00\xff\xff\x86\x00\xfe\xff\x87\x01\xfe\xff\x89\x00\xff\xff\x8b\x01\xfe\xff\x8c\x00\xff\xff\x8e\x01\xfe\xff\x8f\x00\xff\xff\x91\x01\xfe\xff\x93\x00\xff\xff\x95\x01\xfe\xff\x95\x00\xff\xff\x97\x00\xff\xff\x98\x00\xff\xff\x9a\x00\xff\xff\x9c\x01\xff\xff\x9d\x00\xff\xff\x9f\x01\xff\xff\xa0\x00\xff\xff\xa2\x01\xff\xff\xa3\x01\xff\xff\xa4\x00\xbf\xffx\x00`\xffy\x01\xff\xffz\x00\xff\xff|\x01\xff\xff~\x01\xff\xff\x80\x00\xff\xff\x80\x00\xff\xff\x82\x01\xff\xff\x83\x00\xff\xff\x85\x00\xfe\xff\x86\x01\xff\xff\x88\x00\xff\xff\x8a\x00\xff\xff\x8b\x01\xff\xff\x8d\x00\xff\xff\x8e\x00\xff\xff\x90\x00\xff\xff\x91\x00\xff\xff\x93\x00\xff\xff\x95\x00\xff\xff\x96\x01\xfe\xff\x97\x00\xff\xff\x99\x00\xff\xff\x9b\x00\xfe\xff\x9c\x01\xfe\xff\x9d\x01\xff\xff\x9f\x00\xff\xff\xa0\x00\xff\xff\xa2\x01\xff\xff\xa3\x00\xff\xff\xa5\x00\xff\xff\xa6\x00_\x00\x00\x00\x00\xffz\x01\xcf\xff|\x00\xff\xff~\x01\xfe\xff\x80\x01\xff\xff\x81\x00\xff\xff\x82\x01\xff\xff\x83\x01\xfe\xff\x86\x01\xff\xff\x86\x00\xfe\xff\x88\x01\xfe\xff\x8a\x01\xfe\xff\x8b\x01\xfe\xff\x8d\x00\xff\xff\x8e\x00\xfe\xff\x90\x00\xfe\xff\x91\x00\xff\xff\x93\x00\xfe\xff\x95\x00\xff\xff\x97\x00\xfe\xff\x97\x00\xff\xff\x99\x00\xff\xff\x9a\x00\xff\xff\x9c\x00\xff\xff\x9e\x01\xfe\xff\x9f\x00\xff\xff\xa1\x00\xff\xff\xa2\x01\xff\xff\xa4\x01\xfe\xff\xa5\x00\xff\xff\xa7\x00\xbf\x00\x00\x00\x00\x00\x00\x00\x00\xff\x80\x00\x10\xff}\x00\xbf\xff\x80\x01\xfe\xff\x81\x00\xff\xff\x83\x00\xff\xff\x84\x01\xfe\xff\x85\x00\xff\xff\x87\x01\xff\xff\x89\x01\xff\xff\x8a\x00\xff\xff\x8b\x00\xff\xff\x8d\x01\xfe\xff\x8e\x00\xff\xff\x90\x00\xff\xff\x92\x01\xfe\xff\x94\x00\xfe\xff\x94\x00\xff\xff\x96\x00\xff\xff\x98\x00\xff\xff\x99\x00\xff\xff\x9b\x00\xff\xff\x9c\x00\xff\xff\x9d\x00\xff\xff\x9f\x01\xff\xff\xa1\x01\xff\xff\xa2\x01\xff\xff\xa3\x00\xff\xff\xa5\x00\xff\xff\xa7\x00\xcf\xff\x9f\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\x81\x00_\xff\x83\x00\xbf\xff\x84\x00\xef\xff\x85\x00\xfe\xff\x87\x00\xff\xff\x89\x01\xfe\xff\x8a\x00\xff\xff\x8c\x00\xff\xff\x8d\x00\xff\xff\x90\x01\xfe\xff\x90\x00\xff\xff\x92\x01\xff\xff\x94\x01\xff\xff\x95\x00\xff\xff\x97\x00\xff\xff\x98\x00\xff\xff\x9a\x01\xfe\xff\x9b\x00\xff\xff\x9d\x01\xfe\xff\x9e\x00\xff\xff\x9f\x00\xff\xff\xa1\x00\xff\xff\xa3\x01\xff\xff\xa4\x00\xff\xff\xa5\x00\xbf\xff\xa6\x00_\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe0\x00\x00\x07\x80\x00\x00\x01\x80\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x01\x80\x00\x00\x01\xe0\x00\x00\x07'

这里打印了两行是Response对象的两个属性,一个是text【str类型】,另外一个是content【字节】

import requests


headers = {
    "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36"
}
reponse = requests.get("https://static.zhihu.com/heifetz/favicon.ico",headers=headers)
with open("favicon.ico","wb") as f:
    f.write(reponse.content)

结果
 

 POST请求

前面我们了解了最基本的 GET 请求另外一种比较常见的请求方式是 POST 使用 requests实现 POST 请求同样非常简单,示例如下:

import requests

date = {
    "name":"germey",
    "age":22
}

response = requests.post(url="http://192.168.1.104/post",data=date)
print(response.text)

结果:
{
  "args": {}, 
  "data": "", 
  "files": {}, 
  "form": {
    "age": "22", 
    "name": "germey"
  }, 
  "headers": {
    "Accept": "*/*", 
    "Accept-Encoding": "gzip, deflate", 
    "Connection": "keep-alive", 
    "Content-Length": "18", 
    "Content-Type": "application/x-www-form-urlencoded", 
    "Host": "192.168.1.104", 
    "User-Agent": "python-requests/2.25.1"
  }, 
  "json": null, 
  "origin": "192.168.1.101", 
  "url": "http://192.168.1.104/post"
}

常用的响应

import requests

response = requests.post(url="http://192.168.1.104/post",data=date)
print(type(response.status_code),response.status_code)
print(type(response.headers),response.headers)
print(type(response.cookies),response.cookies)
print(type(response.url),response.url)
print(type(response.history),response.history)


结果:
<class 'int'> 200
<class 'requests.structures.CaseInsensitiveDict'> {'Server': 'gunicorn/19.9.0', 'Date': 'Tue, 30 Nov 2021 14:26:55 GMT', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '468', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Credentials': 'true'}
<class 'requests.cookies.RequestsCookieJar'> <RequestsCookieJar[]>
<class 'str'> http://192.168.1.104/post
<class 'list'> []

这里分别打印输出 status_code 属性得到状态码,输出 headers 属性得到响应头,输出 cookies 属性得到 Cookies ,输出 url 属性得到URL ,输出 history 属性得到请求历史

状态码常用来判断请求是否成功,而 requests 还提供了一个 置的状态码查询对象 requests.codes, 示例如下:

import requests

response = requests.post(url="http://192.168.1.104/post",data=date)
exit() if not response.status_code == requests.codes.ok else print("Request Successfully")

结果:
Request Successfully

常用的返回码和响应的查询条件

 

 

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/Smart_look/article/details/121643058

智能推荐

pandas(3)缺失值重复值以及时间类型的处理_pandas 根据日期回补数据-程序员宅基地

文章浏览阅读1.7k次。1、缺失值的表现形式:不区分大小写 NAN nan NaN 都是空值2、怎么创建缺失值:None 或者np.nan3、pandas处理缺失值判断isnull()检测整张表中的缺失值的数据df.isnull().any(axis=1)判断哪行中有空值 因为是按列的数据统计的 所以axis=1df.isnull().any(axis=0)判断哪列中有空值。。df.notnull().all(axis=1)判断哪些行中有非空值。。df.notnull().all(axis=0)判断哪些列中有非空值_pandas 根据日期回补数据

C语言——白盒测试_c语言白盒测试方法-程序员宅基地

文章浏览阅读2.8w次,点赞12次,收藏34次。测试C语言部分代码_c语言白盒测试方法

linux pycharm 的tools选项下没有deployment_pycharm没有deployment-程序员宅基地

文章浏览阅读8.1k次。一、问题pycharm 的tools下没有deployment选项,无法进行远程执行。二、前言使用的pycharm版本PyCharm 2019.3.2 (Community Edition)Build #PC-193.6015.41, built on January 21, 2020Runtime version: 11.0.5+10-b520.30 amd64VM: Op..._pycharm没有deployment

[实战]input失焦事件先于点击事件发生时怎么办?_失去焦点优先于点击事件-程序员宅基地

文章浏览阅读2.3k次,点赞2次,收藏3次。例子:看上面这个例子,我们的需求是:点击备注表格时,该表格变为可编辑状态的输入框,会出现输入框、两个按钮。点击对勾时,会修改备注发送给后端修改请求,修改备注,变为不编辑状态,输入框、按钮消失。失去焦点时,输入框同样变为不可编辑状态,输入框、按钮消失。问题的关键在于,input失焦事件总是先于对勾按钮的点击事件发生的。即当我们点击按钮对勾时,已经先失去了焦点,将按钮隐藏了。因此根本不可能..._失去焦点优先于点击事件

wangeditor 取消自动获取焦点_wangeditor默认不获得的焦点-程序员宅基地

文章浏览阅读5.6k次。使用wangeditor 富文本编辑器的时候 在打开的页面的时候 总会自动定位到此处 有时候富文本 在底部时 也会定位到那 很不方便在node_module 中 找到wangeditor/release/wangeditor.js 将this.selection.createRangeByElem($last, false, true);this.selection.restoreSelec..._wangeditor默认不获得的焦点

pytorch使用之微调网络模型_获取线性全连接层的输入维度-程序员宅基地

文章浏览阅读3.6k次。import torchvision.models as models1.调整最后一层输出维度model = models.ResNet(pretrained=True)fc_features = model.fc.in_features# 获取全连接层输入维度model.fc = torch.nn.Linear(fc_features, num_class)2.调整某一层参数impo..._获取线性全连接层的输入维度

随便推点

和我一起作Tess的windbg lab - Lab3, Memory-程序员宅基地

文章浏览阅读131次。原文地址:http://blogs.msdn.com/b/tess/archive/2008/02/15/net-debugging-demos-lab-3-memory.aspx操作步骤:1、产生压力:tinyget -srv:localhost -uri:/BuggyBits/Links.aspx -loop:40002、观察taskmgr的输出,w3wp的内存每秒钟大概...

@在 centos7 下安装 oracle 12c_在设置specify recovery options 时报磁盘空间不足-程序员宅基地

文章浏览阅读1.1k次。@在 centos7 下安装 oracle 12c文章目录@在 centos7 下安装 oracle 12c环境安装必须的软件包前期准备修改 hostname配置 SSH 和 X11 转发安装 Oracle 12c创建目录和部署安装文件创建安装用目录(按照OFA标准)修改 ulimit 值:最大文件描述符数为4096修改 ulimit 值:最大用户进程数为16384增大 tmpfs 到4GB若 ..._在设置specify recovery options 时报磁盘空间不足

程序员的那些反模式-程序员宅基地

文章浏览阅读2.2k次,点赞4次,收藏7次。有鸡汤就有反鸡汤,有模式就有反模式。今天,我们来谈一谈程序员的行为中的那些反模式,涉及程序员的日常工作和学习的各个方面。这些反行为模式,并不针对某些特定的个人。如果你不幸中招,千万不要懊恼,因为这实在太正常不过了,很多反模式的坑我也是亲身踩过的^-^稍微修改几行代码就调试对所有程序员来说,这个行为有一点心理上的原因:工程师都喜欢在做完一点修改之后,立即看到它的效..._反模式开发

人工智能、机器学习和模式识别以及神经网络_智能控制,智能检测,模式识别,神经网络,模糊逻辑,机器学习,人工智能,深度学习,优化-程序员宅基地

文章浏览阅读2.8k次。梯度下降的定义梯度下降问题就是沿着导数下降的地方移动,直到某点梯度最小,这个时候就达到了最优解多变量的梯度下降问题神经网络中遇到的问题是多变量的最优解,即多变量的梯度为零的解局部最优和全局最优问题通常,我们求得的最优解不一定是全局最优解,其可能只是局部最优解。..._智能控制,智能检测,模式识别,神经网络,模糊逻辑,机器学习,人工智能,深度学习,优化

每个人在职场上都不是一帆风顺的,总是会在工作中遇到各种各样的困难_工作没有一帆风顺总有坎坷不平-程序员宅基地

文章浏览阅读2.4k次。每个人在职场上都不是一帆风顺的,总是会在工作中遇到各种各样的困难,这时候有些职场人就会坚持不住,产生消极的情绪,这对我们在职场上的发展是很不利的。为了我们能在职场上更好的发展,一定要学会控制好自己的情绪,要有一定的心理承受能力。有一些人,因为自身性格的原因,喜欢比较与别人在习惯或者生活中的不同,通常会表现出一种自卑的心理。那你一定不要有这样的想法,每个人从小的生活经历不同,做事习惯肯定也不相同,因此我们要在职场上中养成这四个好习惯,让我们在职场上更加自信。要勇于认识自己的缺点在工作中,我们通常会对自己_工作没有一帆风顺总有坎坷不平

Eigen notes_eigen::matrix4f转eigen::affine3f-程序员宅基地

文章浏览阅读193次。Eigen::Affine3与Eigen::Matrix4的转换// Matrix4f to Affine3fEigen::Matrix4f matrixTrans;Eigen::Transform<float, 3, Eigen::Affine> affineTrans (matrixTrans);// Affine3f to Matrix4fEigen::Transf..._eigen::matrix4f转eigen::affine3f

推荐文章

热门文章

相关标签