美文网首页
2020-03-28 respuests 的使用

2020-03-28 respuests 的使用

作者: f5423d3134f0 | 来源:发表于2020-03-28 08:10 被阅读0次
#导入库
import requests
#创建url
url = "https://www.baidu.com/s"
#必要参数
params = {
    'wd': '尚学堂'
}
#get方法
resp = requests.get(url,params=params)
#输出rul
print(resp.url)
#转格式
resp.encoding = "utf-8"
#显示页面文本
html = resp.text
print(html)

总结:新的爬虫方法,比urllib好理解。

相关文章

网友评论

      本文标题:2020-03-28 respuests 的使用

      本文链接:https://www.haomeiwen.com/subject/eyxjuhtx.html