agentsclimarketplace

Python正则文件修改与条件行追加

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt3.5_8/python正则文件修改与条件行追加

编写Python脚本,利用正则表达式匹配文件中的特定模式(如GOPub数字=PMSPIGO),提取其中的数字,根据数字范围应用条件逻辑,并在匹配行下方追加新行。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill python正则文件修改与条件行追加

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.1 KB, 499 tokens by cl100k_base, as published. Nobody here has run it

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正则匹配数字并根据范围追加行
  • 根据数字范围修改文件内容

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.