08 2019 档案
python图像处理
摘要:1、图片尺寸修改from PIL import Imagedef resizeImage(image_in, image_out): """ 修改jpg 图片尺寸到 200kb 左右 """ width = 1600 img = Image.open(image_in) w, h = img.siz 阅读全文
posted @ 2019-08-26 11:23 芦苇草鱼 阅读(323) 评论(0) 推荐(0)
python删除文件或者目录
摘要:import os #os.walk遍历目录后,删除文件和目录def rmDirAndFile(path): #先把各个目录的文件删除完 for root, dirs, files in os.walk(path): for file in files: filepath = os.path.joi 阅读全文
posted @ 2019-08-19 11:58 芦苇草鱼 阅读(1836) 评论(0) 推荐(0)
python循环执行程序的装饰器
摘要:1、从一个页面切换到另外一个页面时,里面点击控件会报控件找不到的错误,需要循环点击直到成功的那次才算完成; 阅读全文
posted @ 2019-08-19 11:16 芦苇草鱼 阅读(651) 评论(0) 推荐(0)
python中logging模块的使用
摘要:import osimport loggingimport timeimport tracebackimport re#os.listdir删除文件def rmFile(path): files = os.listdir(path) for file in files: file_path = os 阅读全文
posted @ 2019-08-19 10:45 芦苇草鱼 阅读(274) 评论(0) 推荐(0)
python中yield迭代器
摘要:excel数据有上千条,最好不要一次性全部读出来放在列表会消耗内存,需要每读一条用yield返回一条;当运行到yield '';的时候,程序暂停了,不会往下继续执行, class SDMS(object): def cpyExcel(self, path): if os.path.isfile(pa 阅读全文
posted @ 2019-08-19 10:41 芦苇草鱼 阅读(302) 评论(0) 推荐(0)
python计算程序执行时间的装饰器使用
摘要:1、经常被问程序执行了多久,每个函数都去写很麻烦,所以打算写个装饰器自动计算程序执行时间;推荐文档,大多数基础题都有: https://python3-cookbook.readthedocs.io/zh_CN/latest/ import timedef clock(func): def cloc 阅读全文
posted @ 2019-08-19 10:25 芦苇草鱼 阅读(1407) 评论(0) 推荐(0)
redis使用
摘要:1、aof文件不产生问题 1.1直接redis-server.exe不会产生,在命令redis-server后加上要修改的配置名和值(可以设置多对),没有设置的将使用默认配置; 如:redis-server --port 6389 –timeout 3000 虽然可以自定义配置。但是如果修改的配置较 阅读全文
posted @ 2019-08-16 17:48 芦苇草鱼 阅读(265) 评论(0) 推荐(0)
django使用
摘要:1、django报错"GET /static/plugins/bootstrap/css/bootstrap.css HTTP/1.1" 404 1718, 1、django报错"GET /static/plugins/bootstrap/css/bootstrap.css HTTP/1.1" 40 阅读全文
posted @ 2019-08-09 11:14 芦苇草鱼
git 使用
摘要:1、git 错误 fatal: Not a valid object name: 'master'. 现在一开始的时候建立一个新的分支dev进行开发,执行 Git branch dev,出现错误 :fatal: Not a valid object name: 'master'. 原来,Git要先c 阅读全文
posted @ 2019-08-08 11:57 芦苇草鱼 阅读(278) 评论(0) 推荐(1)