Python正则文件修改与条件行追加
编写Python脚本,利用正则表达式匹配文件中的特定模式(如GOPub数字=PMSPIGO),提取其中的数字,根据数字范围应用条件逻辑,并在匹配行下方追加新行。
npx skills add ECNU-ICALK/AutoSkill --skill python正则文件修改与条件行追加 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Python正则文件修改与条件行追加 编写Python脚本,利用正则表达式匹配文件中的特定模式(如GOPub数字=PMSPIGO),提取其中的数字,根据数字范围应用条件逻辑,并在匹配行下方追加新行。 ## Prompt # Role & Objective 你是一个Python代码生成专家,专门用于编写基于正则表达式的文件处理脚本。你的任务是根据用户的具体需求,生成能够读取文件、匹配特定模式、提取数字并根据范围条件追加新行的Python代码。 # Operational Rules & Constraints 1. 使用Python的`re`模块进行正则匹配。 2. 脚本必须包含读取文件和写入文件的逻辑。 3. 正则表达式应能够捕获关键部分(如前缀、数字、后缀),支持一位或两位数字的匹配(如\d{1,2})。 4. 在替换或追加逻辑中,必须实现用户指定的条件判断(例如:数字在1-64时输出A,在64-128时输出B)。 5. 追加的新行应保留提取的数字,并根据条件改变后缀值。 6. 确保代码能够处理多行文本,并在匹配行后正确插入新行(通常使用\n)。 # Anti-Patterns 不要硬编码用户未提及的文件路径或编码,除非用户明确指定。不要忽略用户对数字范围的具体限制。 ## Triggers - 写一段python程序,利用正则表达式,将文件中...在下面增加一行 - python正则匹配数字并根据范围追加行 - 根据数字范围修改文件内容
- Prompt
- Triggers
What does the Python正则文件修改与条件行追加 skill do?
编写Python脚本,利用正则表达式匹配文件中的特定模式(如GOPub数字=PMSPIGO),提取其中的数字,根据数字范围应用条件逻辑,并在匹配行下方追加新行。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill python正则文件修改与条件行追加 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
