
爬虫
OK~
这个作者很懒,什么都没留下…
展开
-
【爬虫】爬取网易首页源代码
import urllib.request web_urls="http://www.163.com" response=urllib.request.urlopen(web_urls) print(response.read().decode("gbk")) #查看网页编码。判断如何解码原创 2018-09-12 15:51:01 · 867 阅读 · 1 评论 -
【爬虫】模拟百度搜索,爬取搜索界面源代码
import urllib.requestimport urllib.parseget_data={'wd':'中国'}get_data_encode=urllib.parse.urlencode(get_data)request_url='http://www.baidu.com/s'request_url+='?'+get_data_encodeprint(request_url)...原创 2018-09-12 16:37:34 · 2915 阅读 · 3 评论 -
【爬虫】爬取我的优快云中的信息
爬取博客标题from urllib import requestfrom lxml import etreepage=1total=0while page<=2: request_url="https://blog.youkuaiyun.com/weixin_38052444/article/list/"+str(page) response=request.urlopen(...原创 2018-09-13 10:58:09 · 317 阅读 · 0 评论 -
selenium 模拟百度搜索 及其他操作
主要代码from selenium import webdriver #要想使用selenium的webdriver 里的函数,首先把包导进来嘛import timechromedriver = r"C:\Users\123\AppData\Local\Google\Chrome\Application\chromedriver.exe" #我们需要操控哪个浏览器呢?Chrome,当然...原创 2018-09-14 22:31:34 · 1145 阅读 · 2 评论 -
正则
\w 匹配字母数字及下划线\W 匹配f非字母数字下划线\s 匹配任意空白字符,等价于[\t\n\r\f]\S 匹配任意非空字符\d 匹配任意数字\D 匹配任意非数字\A 匹配字符串开始\Z 匹配字符串结束,如果存在换行,只匹配换行前的结束字符串\z 匹配字符串结束\G 匹配最后匹配...转载 2018-12-04 15:24:02 · 309 阅读 · 0 评论 -
【爬虫】Requests
The Website is the APIRequests库的7个主要方法方法说明requests.request()构造一个请求,支撑一下各方法的基础方法requests.get()获取HTML网页的主要方法,对应于HTTP的GETrequests.head()获取HTML网页头信息的方法,对应于HTTP的HEADrequests.post()...原创 2018-12-03 16:33:57 · 323 阅读 · 0 评论