摘要:
PhantomJS是一种没有界面的浏览器,便于爬虫 1、PhantomJS下载 2、phantomjs无须安装driver,还有具体的api参考: http://phantomjs.org/api/command-line.html 3、配置config.py 4、爬取如下spider.py 阅读全文
摘要:
流程如下: #1 配置好MongoDB的依赖库 #2 模拟搜索街拍的请求信息 #3 通过请求返回的json返回的url地址再次爬取 #4 爬取新的url地址,并爬取相关的图片地址 #5 获取url地址,并将爬取数据写至MongoDB,且通过二进制流下载下来,若文件相同,则通过md5判断 1、相关配置 阅读全文
摘要:
1、下载MongoDB 地址:【https://www.mongodb.com/download-center?jmp=nav#atlas】好像需要注册,可以从下面下载 【http://dl.mongodb.org/dl/win32/x86_64】 2、安装MongoDB 3、在安装路径下创建数据库 阅读全文
摘要:
1 python特点 2 python使用缩进 3 多个语句在一行使用;分隔 4 注释为#,多行注释doc string() 5 cmd的pip安装 6 pip install selenium #安装 7 pip list #查看安装了哪些包 8 pip uninstall selenium #卸载 9 ... 阅读全文
摘要:
import json import re import requests from requests import RequestException from multiprocessing import Pool #引入进程池 def get_page(url):#获取网页 try: headers={'User-Agent': '... 阅读全文
摘要:
import requests import unittest import HTMLTestRunner class interface(unittest.TestCase): def setUp(self): pass def test_case1(self): url = 'http://www.baidu.com' #百度 ... 阅读全文
摘要:
import unittest import ddt #第三方库 data=[[1,2],[3,4],[5,6]] @ddt.ddt class MyTestCase(unittest.TestCase): #只有一个参数时 @ddt.data(1,2,3) def test_01(self,a): print(a) @ddt.data... 阅读全文
摘要:
1、csv读写的文件 2、读写excel(*.xls) 2.1读 2.2写 2.3更新 阅读全文
摘要:
爬虫基本知识 这阵子需要用爬虫做点事情,于是系统的学习了一下python爬虫,觉得还挺有意思的,比我想象中的能干更多的事情,这里记录下学习的经历。 网上有关爬虫的资料特别多,写的都挺复杂的,我这里不打算讲什么大道理,因为其实爬虫挺好理解的。就是下面一个流程: Created with Raphaël 阅读全文
摘要:
# -*- coding:utf-8 -*- from bs4 import BeautifulSoup as bs import re html_doc = """ The Dormouse's story试试 The Dormouse's story Once upon a time there were three little sisters; and their names we... 阅读全文