- 博客(9)
- 资源 (1)
- 收藏
- 关注
原创 MySQL数据库命令行操作(2)
– 查询 – 查询所有字段 – select * from 表名; select * from students; -- 查询指定字段 -- select 列1,列2,... from 表名; select name, gender from students; -- 使用 as 给字段起别名 -- select 字段 as 名字.... from 表名; select name as 姓名, ...
2019-01-25 15:11:13
203
原创 MySQL数据库命令行操作(1)
– 数据库的命令行操作 --启动、停止、重启mysql服务器的命令 --启动命令 sudo service mysql start --停止服务 sudo service mysql stop --重启服务 sudo service mysql restart -- 命令行链接数据库 -- mysql -uroot -p密码 -- mysql -uroot -p -- sql语句最后需要有分号...
2019-01-25 15:10:06
193
原创 scrapy爬虫的一些命令行命令
scrapy爬虫 创建项目 scrapy startproject 项目名 创建一个名为itcast的爬虫,并指定爬取域的范围 scrapy genspider itcast “itcast.cn” scrapy crawl 项目名 -------------启动爬虫 scrapy-redis分布式爬虫启动项目 scrapy runspider 项目名.py redis-cli -h window...
2019-01-25 15:06:42
1239
1
原创 用一个函数,过滤爬虫抓取数据当中所有的HTML标签
def re_html(self, data): # 替换抓取数据中的html标签 try: message = str(data) re_h = re.compile(’</?\w+[^>]*>’) # html标签 ret1 = re_h.sub(’’, message) return ret1 except: pass ...
2019-01-22 16:58:16
978
原创 scrapy爬虫-TB模拟登陆抓取数据
(我用的谷歌浏览器,在淘宝登录页面,按F12键进入检查模式,点击Network,勾选Preserve log,点击登陆,这样就记录下了登陆需要提交的所有参数) -- coding: utf-8 -- import scrapy import re import json import time from tao_bao_data.items import TaoBaoDataItem class ...
2019-01-02 18:16:12
5340
原创 在服务器上部署爬虫定时运行
1、在合适的地方vim cai_piao.sh 创建并编辑文件 #!/bin/sh cd /home/python/Desktop/cai_piao_number # 进入到爬虫项目的路径 python3 main.py # 运行爬虫项目启动的主函数 2.在当前界面输入 crontab -e 点击Enter键进入编辑 在每天的21点自动启动运行 /home/python/Deskt...
2019-01-02 17:59:30
1890
原创 从数据库中读取图片链接,用协程gevent将图片下载到指定目录保存
1、链接数据库 from pymysql import * # 创建connection链接, 链接数据库 conn = connect(host='192.168.79.136', port=3306, database='yi_heng', user='root', password='abc123@2018', charset='utf8') # 获取cursor游标对象 cursor...
2018-12-05 13:37:45
205
原创 多特瑞商品信息抓取(scrapy爬虫框架)
1、spider目录下爬虫项目(duo_te_rui.py) -- coding: utf-8 -- import scrapy import re from Duo_te_rui.items import DuoTeRuiItem class DuoTeRuiSpider(scrapy.Spider): # 爬虫项目名 name = ‘duo_te_rui’ # 爬虫允许的域 allowed_d...
2018-12-05 13:31:09
226
原创 python基础编程练习
1、for循环生成菱形 s = '’ for i in range(1, 10, 2): print((si).center(9)) for i in reversed(range(1, 8, 2)): print((s*i).center(9)) 2、python内置函数实现两个列表组成字典 a = [‘a’, ‘b’, ‘c’] b = [1, 2, 3] c = dict(zip(a, b)...
2018-12-05 13:15:29
343
淘宝模拟登陆
2018-12-03
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人