(o≖◡≖)
5篇文章.
2020-12-11 4k 68 python | Hcuan
验证码识别 > 提取图片人工打码…… 第三方验证码识别库 + pytesseract + 百度 OCR + 超级鹰 请求中 cookie等值的存储。 > 对于请求 登录页面等,会在本地设置 cookie的链接。可以通过 `session = requests.Session()`, > 创建一个 session对象(用法...2020-12-11 2k 92 python | Hcuan
协程的 async/await 实现 ```python import asyncio async def request(url): print('开始请求', url) print('结束请求', url) return url + ' |--over' def callback_func(task): task, 回调函数,获取返回值...2020-12-20 2k 96 python | Hcuan
+ greenlet (早期:每一次都要人为的去指向下一个该执行的协程) ```python from greenlet import greenlet def func1(): print('func_1') gr2.switch() 2, 切换到 func2 print('func_1-1') gr2.switch() 4, 切换为...2020-12-21 4k 76 python | Hcuan
异步操作 Redis > 在通过 python代码操作redis时,链接/操作/断开都是网络IO。需要模块 `aioredis` ```python import asyncio import aioredis async def execute(address, password): print("开始执行:", address) ...2020-12-22 8k 66 python | Hcuan
> 异步:通过一个线程利用其IO等待事件去做一些其他事情。(用更少的资源做更多的事情) 协程(微线程) > 协程不是计算机提供的,而是程序员人为创造。(让一个线程在代码中游走的运行 实现: + greenlet (早期:每一次都要人为的去指向下一个该执行的协程) + gevent (基于...