requests,Python HTTP 请求库,相当于 Android 的 Retrofit,它的功能包括 Keep-Alive 和连接池、Cookie 持久化、内容自动解压、HTTP 代理、SSL 认证、连接超时、Session 等很多特性,同时兼容 Python2 和 Python3。

 

第三方库的安装:

pip install urllib

pip install requests

 

 

小爬虫代码如下:

#获取center标签下的img标签
for img in imgs:
urllib.request.urlretrieve(img['src'], local + '%s.jpg' % (x))
x =x+1



相关文章:

  • 2022-03-04
  • 2023-04-03
  • 2022-12-23
  • 2021-07-02
  • 2023-04-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-10
  • 2021-04-22
相关资源
相似解决方案