自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

呆小宇-thinking

分享学习经历~

  • 博客(12)
  • 问答 (1)
  • 收藏
  • 关注

原创 pyspider centos 环境报错 需要降低部分包版本

pip install flask==1.0python -m pip install werkzeug==0.16.1pip install wsgidav==2.4.1

2024-02-15 12:51:57 351

原创 python 读取大文件

def myreadlines(f, newline): buf = "" while True: while newline in buf: pos = buf.index(newline) yield buf[:pos] buf = buf[pos+len(newline):] chunk = f.read(12) if not chunk: ..

2022-04-14 14:59:54 571

转载 python 生成器的原理

Python函数生成器原理及使用详解 / 张生荣Python函数生成器原理及使用详解 1.python函数运行原理 import inspect frame = None def foo(): bar() def bar(): global frame frame = inspect.currentframe() pass # python解释器 python.exe 会用一个叫做PyEval_EvalFrameEx(c语言函数)去执行foo函数,首先会创建一个栈帧(stack frame), """ py

2022-04-14 14:57:23 138

原创 python 实现Fibonacci

# 递归方式求斐波那契数列第n位def fib1(index): if index <= 2: return 1 else: return fib1(index-1)+fib1(index-2)# 返回前n位 斐波那契列表def fib2(index): re_list = [] n,a,b = 0,0,1 while n < index: re_list.append(b) a,.

2022-04-14 14:48:55 705

原创 几种js渲染方式的demo

几种js渲染方式的demo使用selenium使用requests_html(基于pyppeteer)使用splash使用pyppeteer使用seleniumimport selenium.webdriverimport timeimport selenium.webdriverclass Spider(object): def __init__(self): self.spidername="xxx_com" self.chromedriver_pat

2020-08-25 10:26:12 494

原创 urllib.parse.quote_plus(url)

urllib.parse.quote_plus(url)

2019-10-14 16:31:43 1894

原创 centos 上python2和python3共存之后防火墙修改

vim /usr/sbin/firewalld vim /usr/bin/firewall-cmd这俩处改为python2的执行环境,否则防火墙相关命令将无法正常使用

2019-10-11 10:51:27 134

原创 centos7 安装pyspider遇到的坑

不要用最新版本的python,否则会有一堆错误要改 pycurl安装报错 参考这位大佬博客Liu-YanLin》https://blog.csdn.net/qq_32502511/article/details/80606636 最后又出现 Deprecated option 'domaincontroller': use 'http_authenticator.domain_...

2019-10-11 10:43:30 254

原创 python aiohttp遇到的坑

出现 missing 1 required positional argument: 'url'" 多半是写错了, 例如 正确写法 程序可以正常运行,但出现 client_session: <aiohttp.client.ClientSession object at 0x000000000CC98908> Unclosed connector ...

2019-10-10 13:48:07 927

原创 爬虫学习笔记(点击加载内容的爬取)-001

今天再爬一个网站时遇到通过jsonp的形式回传后续内容的网站 (如图):经过观察发现每点击一个这个按钮,浏览器就会发送两个get请求: 而第一个参数里边返回的内容正好是我们要的东西,此时再看它的url:https://shankapi.ifeng.com/shanklist/_/getColumnInfo/_/default/6470973085922103296/154280...

2018-11-22 16:25:42 5322 1

原创 app抽取数据时小细节(post请求-pyspider框架)

1.   最好不要把headers写在crawl_config 中,并注意是正确的json格式2.   有的headers 中的东西并不需要添加,添加反而会报错3.   self.crawl() 中的data 参数 需要区分是以字典形式传还是字符串形式 ...

2018-11-20 18:03:51 269

原创 pyspider 构造多个post请求

今天爬取一个网站时,发现网站列表数据都是post回传,data参数变化,如果直接用如下的方式写:def on_start(self):        s = [1,2,3,4,5,6,7]        for i in s:            for x in range(1,20):                data = {                    'm...

2018-11-15 15:42:30 563

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除