python全栈系列爬虫篇——一些常用语法的实现总结.pdfVIP

  • 2
  • 0
  • 约1.02万字
  • 约 9页
  • 2023-07-16 发布于上海
  • 举报

python全栈系列爬虫篇——一些常用语法的实现总结.pdf

python全栈系列爬⾍篇——⼀些常⽤语法的实现总结 ⽬录 ⼀、requests模块⽤法 1、get请求 # 安装requests # pip install requests # 国内源 # pip install -i /simple requests import requests # 1、get获取搜索信息 url = /web?query=周杰伦 headers_value = { User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 } resp = requests.get(url, headers=headers_value) print(resp.text) # 关闭连接 resp.close() 2、post 请求 import requests url = /sug s = input(请输⼊你要翻译的英⽂单词) dat = { kw: s } # 发送post请求, 发送的数据必须放在字典中,

文档评论(0)

1亿VIP精品文档

相关文档