python-3.x - python处理文本文件中的特定部分
问题描述
我有 3 个包含 4 个部分的文件(示例)
File 1 File 2 File 3
Section 1 Section 1 Section 1
---------- ---------- ----------
Data 1 Data 1 Data 1
Section 2 Section 2 Section 2
---------- ---------- ----------
Data 2 Data 2 Data 2
Section 3 Section 3 Section 3
---------- ---------- ----------
Data 3 Data 3 Data 3
Section 4 Section 4 Section 4
---------- ---------- ----------
Data 4 Data 4 Data 4
我只想将第 2 节附加到新文件中。任何想法如何做到这一点?
Output:
NewFile
Data 2 Of File 1
Data 2 Of File 2
Data 2 Of File 3
etc... (If I have more files)
谢谢你
解决方案
推荐阅读
- docker - 持续集成和平均堆栈
- angular - 错误:找不到模块“@angular-devkit/schematics”和找不到模块“@angular-devkit/schematics”
- go - func 关键字后的两个函数名 - 它是什么?
- security - Burp Suite Professional 错误无法连接到 127.0.0.1:80
- swift - ios Swift中的Paytm付款缺少参数问题
- javascript - 脚本在 jquery 之前加载
- android - ViewHolder Pattern with Views inside Views 显示重复
- java - ThreadPoolTaskScheduler 运行任务,为什么未来是一样的?
- javascript - 如何使用 for 循环将运算符 (+,-,x,/) 用于数组?
- php - 如何将多维cookie作为变量?