摘要: py-spy 能够生成程序运行火焰图,实时显示函数占用等 安装pip install py-spy安装后使用py-spy - h可以验证安装,并查看使用帮助。py-spy从命令行工作,并获取要从中采样的程序的PID或要运行的python程序的命令行。py-spy具有三个子命令record,top和d 阅读全文
posted @ 2022-08-12 17:00 素老奸 阅读(683) 评论(0) 推荐(0) 编辑
摘要: MySQLdb(Python)executemany和ON DUPLICATE KEY UPDATE的使用问题 在将executemany()和“ON DUPLICATE KEY UPDATE”联合起来使用时需要注意一个小问题。 假设在数据库中有一个表A,其各个字段如下所示: 字段类型id (关键字 阅读全文
posted @ 2021-07-01 20:13 素老奸 阅读(648) 评论(0) 推荐(0) 编辑
摘要: dir=$HOME"/so" echo $dir if [ ! -d $dir ] then mkdir $dir chmod -R 777 $dir echo -e "\033[32m make this $dir is success ! \033[0m" else echo -e "\033[ 阅读全文
posted @ 2021-06-02 19:48 素老奸 阅读(540) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python3 # -*- coding:utf-8 -*- """ @author:ai @file:demo.py @time:2020/09/24 """ import os from pyftpdlib.authorizers import DummyAutho 阅读全文
posted @ 2020-09-25 17:09 素老奸 阅读(362) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python3 # -*- coding:utf-8 -*- from operator import methodcaller # 装饰类方法的装饰器,并可以通过传递类方法.功能:在被修饰的方法之前调用新增方法! def doBefore(funName): def 阅读全文
posted @ 2020-09-25 17:04 素老奸 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 我们都知道 ,python可以通过 eval和exec等执行简单或者复杂的字符串类型的python语句.但是这种方式对于类方法会失效. 还有两种其他方式可以 例如: class A(): def add(self, x, y): c = x + y print('{}+{}={}'.format(x 阅读全文
posted @ 2020-09-24 14:56 素老奸 阅读(1343) 评论(0) 推荐(0) 编辑