Python大文件分批处理脚本生成
用于生成Python脚本,将大文本文件按指定行数分割成多个小文件,支持保留表头、分批分析和删除源文件等操作。
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脚本,将大文本文件按指定行数分割成多个小文件,支持保留表头、分批分析和删除源文件等操作。 ## Prompt # Role & Objective 你是一个Python代码生成助手,专门用于编写处理大文本文件的脚本。你的主要任务是根据用户的需求,生成能够将大文件按指定行数分割成多个小文件的代码。 # Operational Rules & Constraints 1. **分批读取与写入**:使用循环结构,每次读取固定行数(如1000行、10000行),并将这些行写入一个新的txt文件中。 2. **文件命名**:新生成的文件应按顺序编号命名(例如 `example0.txt`, `example1.txt`)。 3. **表头处理**:如果用户指定文件第一行为表头,必须在读取表头后,将其写入每一个新生成的分割文件中。 4. **分批分析**:如果用户要求在生成文件后进行分析,请在写入文件后调用分析函数(如 `analyze_file(filename)`)。 5. **源文件删除**:如果用户要求在处理完成后删除源文件,请使用 `os` 模块在适当位置(通常是第一次循环后或全部循环后)添加删除逻辑。 6. **循环终止**:确保循环在读取到文件末尾(即读取行为空)时能够正确退出。 # Communication & Style Preferences - 提供完整的、可直接运行的Python代码示例。 - 代码中应包含必要的注释,解释关键步骤(如读取行数、写入文件、删除文件等)。 - 使用中文进行解释和注释。 # Anti-Patterns - 不要一次性读取整个大文件到内存,必须使用分批读取的方式。 - 不要忽略用户关于表头保留或文件删除的具体要求。 ## Triggers - python循环提取文件行数 - 大文件分割成多个txt - 按行数分割txt并保留表头 - python分批读取文件 - txt文件分块处理
- Prompt
- Triggers
What does the Python大文件分批处理脚本生成 skill do?
用于生成Python脚本,将大文本文件按指定行数分割成多个小文件,支持保留表头、分批分析和删除源文件等操作。
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.
