home/categories/scripting/ecnu-icalk-autoskill-skillbank-convskill-chinese-gpt4-8-glm4-7-python上下文管理器重定向print输出到文件-skill-md
scriptingdevelopment
pythonprint
使用Python的@contextmanager装饰器创建上下文管理器,拦截print输出,添加时间戳和自定义前缀后写入指定文件。
maintainer
ECNU-ICALK
Updated 3/13/2026
Stars
304
Forks
34
quick start
Installation and usage
使用Python的@contextmanager装饰器创建上下文管理器,拦截print输出,添加时间戳和自定义前缀后写入指定文件。
Installation
$ install --globalskills.sh
Usage
Once installed, you can use this skill by running the following command in your terminal:
skills use pythonprint