a method to make some handy tools with python
In my working of computer, there are a lot of simple jobs that are frequently repeated. I tried to find a way to make these job been processed easily.
Method 1: The method is writing a script to do the job, and executing the script by utools
extension utools-ScriptRunner
.
Method 2: writing a script to do the job, giving the script with extension .pyy
, and associating files with pyy
extension to python.exe
to quick lanuch the script. The reason to do these is I want to always open .py
files with vscode
. Then double clicking the .pyy
file or searching the .pyy
file in everything
pressing enter
on the expected item, will both trigger the script.
Example:
# csv2tiff.pyy import re import clipboard import os import cv2 import numpy as np # clipboard.copy("abc") # now the clipboard content will be string "abc" # text = clipboard.paste() # text will have the content of clipboard text = clipboard.paste() lsA = text.splitlines() # lsB = [] # for line in lsA: # line = re.sub(r"\\", "/", line) # theMatch = re.search("^\"*(.*?)\"*$", line) # # print(theMatch) # line = f'"{theMatch.groups()[0]}"' # lsB.append(line) # text = "\n".join(lsB) # clipboard.copy(text) # print(lsA) for idx, ff in enumerate(lsA): print(f"idx {idx:6d} / {len(lsA)} : {ff}") answer = input("are you sure to convert these files?\n`ctrl + C` to exit.") for idx, ff in enumerate(lsA): print(f"idx {idx:6d} / {len(lsA)} : {ff}") img = np.loadtxt(ff, delimiter=",") img = img.astype(np.float32) cv2.imwrite(ff + ".tiff", img) os.system("pause")
reference
wenjinghuan999/utools-ScriptRunner: utools插件,可将监视目录下的所有python脚本文件自动加入关键字列表: https://github.com/wenjinghuan999/utools-ScriptRunner
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具