Python:requests库、BeautifulSoup4库的基本使用(实现简单的网络爬虫) 一、requests库的基本使用 requests是python语言编写的简单易用的HTTP库,使用起来比urllib更加简洁方便。 requests是第三方库,使用前需要通过pip安装。 pip in ...
分类:
编程语言 时间:
2019-11-10 19:44:47
阅读次数:
98
requets requests是python实现的简单易用的HTTP库,使用起来比urllib简洁很多 因为是第三方库,所以使用前需要cmd安装 pip install requests 安装完成后import一下,正常则说明可以开始使用了。 基本用法: requests.get()用于请求目标网 ...
分类:
编程语言 时间:
2019-11-10 19:13:14
阅读次数:
97
一、urllib模块 urllib模块是一个标准模块,直接import urllib即可,在python3里面只有urllib模块,在python2里面有urllib模块和urllib2模块。 urllib模块太麻烦了,传参数的话,都得是bytes类型,返回数据也是bytes类型,还得解码,想直接把 ...
分类:
编程语言 时间:
2019-11-07 09:40:07
阅读次数:
86
一、使用python自带模块urllib 模拟页面请求服务端,python提供了一个urllib模块,作用是通过python代码调用接口进行参数传递并获取到接口的返回值信息 urllib模式是一个标准模块,直接import urllib即可 1、发送get请求 2、发送post请求 二者区别: ge ...
分类:
编程语言 时间:
2019-11-06 22:38:57
阅读次数:
105
看了两三个爬虫程序,就自己写了一个简单的爬虫程序,爬取的是:猫眼电影-榜单-热映口碑榜11月6号的数据 from urllib import request import re def getHtml(url, ua_agent='Mozilla/5.0 (Windows NT 10.0; Win6 ...
分类:
其他好文 时间:
2019-11-06 16:53:19
阅读次数:
91
python版本 代码 urllib是python3.8内置的 效果 ...
分类:
微信 时间:
2019-11-05 13:19:13
阅读次数:
178
"""#最基本,请求地址无参数# response=urllib.request.urlopen("https://www.scetc.edu.cn")## html=response.read().decode("utf-8")## print(html) #第二种,传参数的情况#参数的转换 参数 ...
分类:
编程语言 时间:
2019-11-04 22:01:21
阅读次数:
119
一、第一版 第一版比较通俗易懂,使用的是urllib里的request + bs4里的BeautifulSoup,requests库可以代替urllib里的request,命令行显示结果。 from urllib import request from urllib import error fro ...
分类:
其他好文 时间:
2019-11-04 15:21:46
阅读次数:
79
最近Solr又出了一个RCE漏洞,复现了一下 # coding: utf-8import requestsimport argparsefrom urllib import parseif __name__ == "__main__": parser = argparse.ArgumentParse ...
分类:
其他好文 时间:
2019-11-03 12:33:07
阅读次数:
133
# crawl a image import urllib.request response = urllib.request.urlopen("http://placekitten.com/200/300") #load html with open("C:/Users/Mike1/Desktop ...
分类:
其他好文 时间:
2019-11-03 11:08:01
阅读次数:
75