![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
dandanforgetlove
这个作者很懒,什么都没留下…
展开
-
python aiohttp异步多并发协程访问&多个依赖url访问
使用异步进行并发访问:aiohttp大部分可能就只是访问某个url,直接使用aiohttp的异步方式即可。有时候需要访问多层的url,而下一层依赖上一层,需要等待上一层返回才能继续访问。例如获取代理(见第二种)原创 2023-11-06 15:42:33 · 430 阅读 · 0 评论 -
python 获取对象中的属性并进行赋值操作
需要保存十张不同结构表的数据,但是不想写十个实体类赋值的代码。于是乎,想着数据转成dict,然后dict转成实体类。所以主要的就是dict 转换成实体类这里。当然了,还有getattr方法。原创 2023-06-14 15:51:13 · 542 阅读 · 0 评论 -
pdfplumber TypeError: must be str, not bytes
使用 pdfplumber 读取pdf文件时跑出异常,代码入刚开始一直以为是文件有问题。百度了一会无果。GitHub也有此类问题,但是说修复了,没看到方案,最后还是在博客园看到解决方案。原创 2023-04-13 14:49:22 · 260 阅读 · 1 评论 -
如何防止selenium被检测
selenium 通过js会被检测出来,按照其它设置:from selenium.webdriver import Chromefrom selenium.webdriver import ChromeOptionsoption = ChromeOptions()option.add_experimental_option('excludeSwitches', ['enable-automation'])driver = Chrome(options=option)设置 excludeS原创 2022-01-01 17:48:56 · 5141 阅读 · 0 评论 -
python module 下载异常,无法下载安装
直接去module官方包网站下载对应module 到本地安装,网址:Simple Indexhttps://pypi.tuna.tsinghua.edu.cn/simple/打开会有点慢。pycharm 国内源:Simple Indexhttp://mirrors.aliyun.com/pypi/simple/Simple Indexhttps://pypi.tuna.tsinghua.edu.cn/simple/需要复制地址设置方式:1.2.3.4...原创 2021-11-19 10:41:19 · 887 阅读 · 0 评论 -
使用python 进行区间取值
需求背景:进行分值计算。如下图,如果只是一两个还好说,写写判断,但是如果有几十个,几百个,会不会惨不忍睹。而且,下面的还是三种情况。例如:解决:# 根据值、比较list, 值list,返回区间值, other_value 即不在的情况 def get_value_by_between(self, compare_value, compare_list, value_list, other_value, type="compare", left=False,原创 2021-07-30 14:05:14 · 3818 阅读 · 0 评论 -
python 利用joblib将py文件生成pkl
首先,安装 joblib 模块包1.准备好一个python文件class GwSamel(object): def __init__(self): pass def predict(self, input): # 你的逻辑 print(input) return True, "ok"2.生成pkldef dump_pkl(): import joblib # 先声明原创 2021-07-29 15:20:47 · 1436 阅读 · 0 评论 -
python 获取指定日期前后几个月/几天的日期
import timeimport calendar# 获取指定之前的月份 def get_last_month_by_int(self, last_int): ''' :param mon: 获取当前时间X月之前的时间 :return: YYYY-MM ''' now = time.time() return self.get_last_month_by_time_int(now, last_in.原创 2021-07-21 11:21:20 · 1906 阅读 · 0 评论 -
python pdfplumber 识别pdf为空 表格识别 文字提取 zipfile解压 bad password
使用python module pdfplumber 提取表格的时候,在window中提取没有任何问题,到了linux上,发现提取出来的文字全部为空,使用tabula 可以,但是结果bu'zhu原创 2021-06-19 17:53:39 · 2561 阅读 · 1 评论 -
python 提取pdf中表格(单元格)内容
python3.7要求:提取pdf中表格里面的内容,提取每一个单元格中的内容,并且精确。尝试了3种,每种都需要安装不同的module。原创 2021-05-28 10:50:30 · 878 阅读 · 0 评论 -
bat 文件使用python 执行某个 py
@echo off@py.exe countTime.py %*@pause原创 2020-10-13 13:51:28 · 268 阅读 · 0 评论 -
no module ‘fcntl‘、module ‘fcntl‘ has no attribute ‘LOCK_UN‘
no module 'fcntl'或module 'fcntl' has no attribute 'LOCK_UN'原因:windows 不支持该module!!!!!!以上是Linux下的环境。根据网上的内容如下 fcntl.py#fcnt1.pyLOCK_UN=8def fcntl(fd, op, arg=0): return 0 def ioctl(fd, op, arg=0, mutable_flag=True): if mutabl...原创 2020-09-01 17:23:56 · 1733 阅读 · 0 评论