上一页 1 2 3 4 5 6 7 8 ··· 16 下一页
摘要: C:\Python37\python3.exe D:/shannanai_spider/crawler_algorithm/test.pyTraceback (most recent call last): File "D:/shannanai_spider/crawler_algorithm/te 阅读全文
posted @ 2021-05-18 16:59 淋哥 阅读(7735) 评论(0) 推荐(0)
摘要: 使用mysql将同一数据库的表格数据(根据条件筛选的部分数据)转换到当前数据库下另一个表格中,使用了插入和删除操作,由于数据量较大导致报错:1206 - The total number of locks exceeds the lock table size 解决方案: 在进入MySQL命令行控制 阅读全文
posted @ 2021-05-07 14:18 淋哥 阅读(485) 评论(0) 推荐(0)
摘要: 在爬虫有一些需求需要把多个空格替换一个或者是把多个相同的字符值保留一个,实现方法用re.sub 直接上代码 strs = "核算处 期" new_strs = re.sub(r" +",' ', strs) print(new_strs) strs = "核算处 期" new_strs = re.s 阅读全文
posted @ 2021-04-28 19:36 淋哥 阅读(2116) 评论(0) 推荐(1)
摘要: 今天想知道for循环的速度,所以做一下测试 1. for循环一万次 耗时2毫秒 2. for循环十万次 耗时22毫秒 3. for循环一百万次 耗时304毫秒 4. for循环一千万次 耗时2337毫秒,也就是2.3秒 5. for循环一亿次 耗时23468毫秒,也就是23.4秒 为什么要做这个测试 阅读全文
posted @ 2021-04-20 21:47 淋哥 阅读(4700) 评论(0) 推荐(0)
摘要: 123 阅读全文
posted @ 2021-04-19 17:12 淋哥 阅读(50) 评论(0) 推荐(0)
摘要: 1 . python3 环境 python3 content 输出是 bytes text 输出是 str python 2 环境 python2 content 输出是 str text 输出是 unicode 阅读全文
posted @ 2021-04-15 15:13 淋哥 阅读(244) 评论(0) 推荐(0)
摘要: https://www.cnblogs.com/AllBloggers.aspx 阅读全文
posted @ 2021-04-14 09:21 淋哥 阅读(48) 评论(0) 推荐(1)
摘要: 直接上代码备忘 import smtplib from email.mime.text import MIMEText from email.header import Header from email.mime.multipart import MIMEMultipart def send_em 阅读全文
posted @ 2021-04-02 11:07 淋哥 阅读(91) 评论(0) 推荐(0)
摘要: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 48: ordinal not in range(128) url = 'http://gasssmes.sgerisssnssssass.cssn/pc/new 阅读全文
posted @ 2021-03-31 13:33 淋哥 阅读(123) 评论(0) 推荐(0)
摘要: 以前解决这个问题,具体怎么解决的忘记了,这次有遇到同样的问题了,bing了好一段时间,这次记录下来以防止再次忘记 爬虫抓取的数据有四个字节,还是表情符号 使用的技术是 python2.7 mysql8.0 mysqldb 1. 创建数据表 CREATE TABLE `tests` ( `url_id 阅读全文
posted @ 2021-03-29 09:40 淋哥 阅读(114) 评论(0) 推荐(0)
摘要: 直接上传代码 # coding: utf-8 import paramiko import os import time def file_transfer(): start_time = time.time() host = '' port = 22 username = '' password 阅读全文
posted @ 2021-03-29 08:48 淋哥 阅读(707) 评论(0) 推荐(0)
摘要: 1. 问题描述: 往MySQL批量插入数据,一次插入六万行数据,大约是一个6M的json文件,然后报错 2006, 'MySQL server has gone away' 解决方法: 1. 执行命令 show global variables like 'max_allowed_packet'; 阅读全文
posted @ 2021-03-26 11:10 淋哥 阅读(348) 评论(0) 推荐(0)
摘要: 在上篇文章中说了 mysql 查询慢的优化问题 文章标题是 mysql count 统计数据行数速度慢的解决方案 这篇文章着重分析selct count 为什么这么慢的原因 1。先查看MySQL数据表结构 CREATE TABLE `spider_71_ggzy_zgzfcgw_content` ( 阅读全文
posted @ 2021-03-26 11:09 淋哥 阅读(192) 评论(0) 推荐(0)
摘要: 直接上脚本 # -*- coding: utf-8 -*- from elasticsearch import Elasticsearch # 日志的配置环境 import platform import logging.handlers sys_platform = platform.system 阅读全文
posted @ 2021-03-26 11:08 淋哥 阅读(932) 评论(0) 推荐(0)
摘要: MySQL 数据库有一张表,数据量是6800w条,现在使用count 对数据进行统计 1. 首先看下MySQL的表结构 CREATE TABLE `business_dict` ( `url_id` int(11) NOT NULL AUTO_INCREMENT, `company_name` va 阅读全文
posted @ 2021-03-16 09:38 淋哥 阅读(467) 评论(0) 推荐(0)
摘要: 1. 安装 pip install threadpool 2. 介绍 threadpool 支持python2.7和python3.x,线程池是一个对象,它维护一个工作线程池来并行执行耗时的操作。它通过将作业放入工作请求队列中将作业分配给这些线程,在那里它们被下一个可用线程拾取。然后在后台执行请求的 阅读全文
posted @ 2021-03-15 10:53 淋哥 阅读(1319) 评论(1) 推荐(0)
摘要: 现在多进程多线程已经是老生常谈了,协程也在最近几年流行起来。python中有协程库gevent,py web框架tornado中也用了gevent封装好的协程。本文主要介绍进程、线程和协程三者之间的区别。 一、概念 1、进程 进程是具有一定独立功能的程序关于某个数据集合上的一次运行活动,进程是系统进 阅读全文
posted @ 2021-03-12 19:39 淋哥 阅读(436) 评论(0) 推荐(0)
摘要: import multiprocessing import time def func(msg): time.sleep(1) print multiprocessing.current_process().name + '-' + msg def spider(): time.sleep(2) p 阅读全文
posted @ 2021-03-12 19:37 淋哥 阅读(4276) 评论(0) 推荐(2)
摘要: 1. 使用croniter 官方教程是:https://github.com/taichino/croniter 示例一:获得下次crontab执行的时间 from croniter import croniter from datetime import datetime print dateti 阅读全文
posted @ 2021-03-12 14:02 淋哥 阅读(5399) 评论(0) 推荐(0)
摘要: 1. 需要对一个java架包每天定时重启,直接使用crontab 2. 停止程序脚本 touch top-spider.sh vim stop-spider.sh 输入如下代码 ps -ef|grep bigdata-crawler-web |grep -v grep | awk '{print $ 阅读全文
posted @ 2021-03-03 09:22 淋哥 阅读(1296) 评论(0) 推荐(0)
摘要: org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{Mln3wtAkTMCwR_z9QIv-tA}{20.0 阅读全文
posted @ 2021-03-03 09:04 淋哥 阅读(448) 评论(0) 推荐(0)
摘要: python脚本删除es 数据 附代码 from Elasticsearch import Elasticsearch host = '20.0.0.11:9200' es = Elasticsearch([host]) query = {'query': {'match': {'url': 'ht 阅读全文
posted @ 2020-12-29 17:47 淋哥 阅读(2192) 评论(0) 推荐(0)
摘要: 1. 查看系统版本 2. 登录linux系统 新建文件夹 执行命令 mkdir /home/test/mysql 3. 下载mysql 数据库 wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.20-el7-x86_64.tar 阅读全文
posted @ 2020-11-24 13:29 淋哥 阅读(1422) 评论(0) 推荐(0)
摘要: # 日期正则匹配 DATETIME_PATTERN = [ r"(\d{4}[-|/|.]\d{1,2}[-|/|.]\d{1,2}\s*?[0-1]?[0-9]:[0-5]?[0-9]:[0-5]?[0-9])", r"(\d{4}[-|/|.]\d{1,2}[-|/|.]\d{1,2}\s*?[ 阅读全文
posted @ 2020-11-18 15:16 淋哥 阅读(307) 评论(0) 推荐(1)
摘要: 火狐Firefox浏览器的历史版本下载地址 下载地址: https://ftp.mozilla.org/pub/firefox/releases/ 火狐Firefox浏览器 驱动 下载地址 https://github.com/mozilla/geckodriver/releases 阅读全文
posted @ 2020-10-29 14:30 淋哥 阅读(839) 评论(0) 推荐(1)
摘要: from lxml import etree html = "需要解析的网页" html = etree.HTML(html) #获取所有的href属性 url_list = html.xpath("//*/@href") for url in url_list: print(url) 阅读全文
posted @ 2020-10-16 17:31 淋哥 阅读(3273) 评论(0) 推荐(1)
摘要: 第一步:打开链接 https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyhook , 下载 pyHook‑1.5.1‑cp27‑cp27m‑win_amd64.whl , 把文章 pyHook‑1.5.1‑cp27‑cp27m‑win_amd64.whl 改为  阅读全文
posted @ 2020-10-13 15:22 淋哥 阅读(336) 评论(0) 推荐(0)
摘要: 问题描述: 有一个mysql数据表,想去统计一下具体有多少行数据,于是就使用了 SELECT COUNT(url_id) FROM `spider_71_ggzy_zgzfcgw_content` 查询了好久也没有出来,有什么解决办法呢? 查询速度慢的 原因是什么? innodb引擎在统计方面和my 阅读全文
posted @ 2020-10-12 11:13 淋哥 阅读(7880) 评论(0) 推荐(0)
摘要: Content-Type: text/x-gwt-rpc; charset=UTF-8 下载某个统计局网站,它的 Content-Type: text/x-gwt-rpc; charset=UTF-8 请求方式是 post 请求 一言不合就上代码 url = 'http://data.ahtjj.g 阅读全文
posted @ 2020-10-11 16:38 淋哥 阅读(771) 评论(0) 推荐(0)
摘要: 直接上代码吧 import pymssql conn = pymssql.connect(host='111111', database='111111', user='1111111', password='11111111', autocommit=True) #核心代码 cursor = co 阅读全文
posted @ 2020-07-12 13:50 淋哥 阅读(1050) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 16 下一页