- 博客(13)
- 资源 (1)
- 收藏
- 关注
原创 python自带tkinter实现一个完整的笔记本,文件打开保存/字体编辑/换行缩放/查询/替换/翻译/截图/工具栏/悬停提示等功能
先放最终效果图:悬停提示:划词在线翻译:查找:替换
2021-03-01 12:13:05 387 8
原创 shell执行python语句并进入交互模式
正常方式进入python交互模式,然后执行导包操作:pythonimport timeprint(time.time())以上操作需要输入3次,如果命令多的话每次都要输入的次数就更多了,能不能简化呢?写一个shell:python -i -c “import time;print(time.time())”保持为test.sh执行sh test.sh,输出结果:sh test.sh1645170569.6046598>>> 加-i是为了保留在python
2022-02-18 15:51:22 672
原创 在使用AIOKafkaConsumer出现异常
经常会出现Unable to request metadata from node with id 1002: KafkaConnectionError(‘Connection at xxx.xxxx.xxx.xxx:8081 closed’,)或者:Failed fetch messages from 1003: [Error 7] RequestTimedOutError或者:Failed fetch messages from 1008: NodeNotReadyError: Attempt to
2021-07-27 10:54:36 792
原创 python如何查询远程主机的sqlite3??
因业务要求,需要ssh登陆远程主机,查询远程主机的sqlte3数据库。但sqlite3模块只支持运行程序所在主机的sqlite3数据库操作。那么,怎么操作远程主机的sqlite3呢?可考虑paramiko模块,先ssh登陆远程主机,然后使用管ssh命令以及管道执行脚本ssh_connect = LOGIN_SSH_HOST_EXT(ipAddr,userName)cmd = f"sqlite3 {bolName} 'select flowid from MetaCrontab where appid
2021-05-18 14:55:15 857 2
原创 python调用析构函数__del__日志模块logging失效问题解析
在工作中写了一个脚本,用python类实现,想在__del__中记录日志信息:def __del__(self): self.log.info("析构进程退出!") self.cursor.close() self.conn.close()调用方法:if __name__ == '__main__': begin_time = time.time() cell = MobileCell() cell.truncateTables() print
2021-05-12 17:43:46 926
原创 打开pgAdmin4报Qt平台插件错误原因排查
今天安装了postgres,打开pgadmin4报错:网上百度了说系统环境变量不正确引起的:后来把这个环境变量删除,就能把pgadmin4打开了。
2021-03-17 15:06:42 332
原创 python自带tkinter实现屏幕中间倒计时
先看 下效果图:代码:import timefrom tkinter import Tk,Labelclass TimeShow():#实现倒计时 def __init__(self,time_show=5): self.timeShowWin=Tk() self.timeShowWin.overrideredirect(True) self.timeShowWin.attributes('-alpha',1) s
2021-03-04 14:28:23 764 1
原创 python用pyinstaller打包后加了-w参数仍然出现黑窗口的原因
使用到了PIL模块,在调用Image.show()就会出现黑窗口,不加就正常。后来查看PIL的代码 Lib\site-packages\PIL\ImageShow.py: def show_file(self, file, **options): """Display the given file.""" os.system(self.get_command(file, **options)) return 1这里调用了os.system,如果
2021-03-02 16:40:06 1166
原创 python-巧妙利用集合对数据库表进行比较统计
笔者所在公司最近上了一个项目,同一套配置参数表需要在oracle与mysql同时配置,为了确保数据一致性,需要定期对这2个不同数据库参数表进行比较。刚开始觉得很简单嘛,先把Oracle表数据存放到一个列表,mysql再存放到另外一个列表,双重循环比较就搞定了。说干就干,写了个demo,先弄一个100多万数据的表比较。代码如下: begin_time =time.time() for row in oracle_ip_list: for mysql_ip in mysql
2020-10-29 09:43:23 507
原创 用python获取kafka起始以及结束断点位置
def getTopicInfo(self,consumer=None): if consumer: mc=consumer else: ##超时设置10秒 mc=kafka.KafkaConsumer(self.topic_name,bootstrap_servers=self.boot_servers,request_timeout_ms=10000) ptnlst=mc.partitions_for_topic(self
2020-10-19 17:38:44 421 1
原创 自动爬取拉勾网
selectnium+requests爬取拉勾网招聘信息,包括一级和二级页面,无需人工干预,全程自动化'''scrapy 拉勾网待完善:不够稳定,在爬取职位详情时,偶尔会出现302重定向其它要点: post请求必须要携带cookie,cookie可以先get一个网页,然后session.cookies获取 后面get可以不带cookies,先session取cookies,...
2020-03-10 10:40:03 267
原创 selectnium+requests爬取boss直聘
selectnium是为了获取cookies,出现验证码时需要把无头模式屏蔽,人工点击验证码只爬取了一级页面,二级页面没有。数据有点乱,没有做数据清理,将就着看吧。# -*- coding: UTF-8 -*-import requests, pymysqlfrom lxml import etreeimport jsonimport timeimport refrom sel...
2020-03-10 10:11:44 1494
原创 pytesseract+tensorflow开发一个自己的验证码训练集
pytesseract模块结合tesseract-ocr软件能识别大部分的验证码,虽然用自己训练的数据跑tesseract识别验证码,具体参考博主:https://blog.csdn.net/Jayj1997/article/details/102882379本人尝试了,很麻烦。用pytesseract对以上这种验证码的识别率也只在75%左右,对于这个准确率实在事不满意。例如验证码:验证...
2020-02-17 19:16:36 1224
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人