Python爬虫——入门
request入门
了解request库,urlopen包(一般情况下,他的英语意思就是这个的功能了)
url= "http://www.baidu.com"
resp=urlopen(url) //打开这个网址,获得一个resp的响应
with open("hell.html",mode="w") as f: //相当于新建一个hell的网页,
f.write(resp.read().decode("utf-8")) //将响应得到的东西,写入f中,代码形式为utf-8
print("over")
``
## get和post的用法
get请求和post请求
在源代码中有标识,
post请求用字典
get请求用param
param是应用?后面的内容,由五部分组成。
headers装的是许可证,反爬的解决方法
## 正则表达式

正则表达式 :(r/^开始$结束。re.S)
find_all:匹配全部
find:匹配一个